In 1801, the astronomer William Herschel noticed a correlation between sunspot activity and the price of wheat. It has long been postulated, by astronomers at least, that there is a relationship between solar activity and climate/weather. The Maunder Minimum, for example, coincided with the Little Ice Age. More recently, Piers Corbyn makes a living predicting the weather from his understanding of solar activity. His predictions are not always perfect, but they are sufficiently good that the bookmaker William Hill will no longer accept bets from him; before the ban, he was in profit as a consequence of betting on his predictions when they differed from those of the Met Office. It is also noteworthy that Habibullah Abdussamatov (Pulkovo Astronomical Observatory) has shown that recent Arean warming has paralleled that of Earth – I guess we'll next have the AGW lobby wanting us to believe in CO2 -producing Martians.
The major scientific objection (as opposed to the political ones: Governments haven't yet found a way to tax sunlight and AGW doom-mongers can't rake in public funding for combatting sunlight) was that the variation in insolation was insufficient to account for temperature differences. All that changed in 2006 when Henrik Svensmark demonstrated that, by mediating cosmic rays, solar activity was indeed a prime suspect as an agent for climate change (something that he had postulated a decade earlier). It works like this:
The overall effect is enormous, to the extent that we should perhaps be asking if human activity is actually having a cooling effect on the planet! Cosmic ray flux is deliberately excluded from the IPCC computer models.
It is also the case that the Sun is more active now than it has been at anytime in the previous 1,000 years. The correlation between cosmic ray flux and temperature is not precise, but analysis of beryllium in Greenland ice cores demonstrates that it is better than that between carbon dioxide and temperature (but that relationship is politically correct, so it requires a much lower level of supporting evidence: special pleading of the first water!). The point is that climate is a complex system and there are many influences on it; nobody is claiming that it has to be cosmic ray flux alone: that is a straw man argument invented by the AGW lobby.