Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Forum Module /

Discuss the Forum Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Gravatar types


Reply


6 Posts   1016 Views

Avatar
wildflower1975

Community Member, 59 Posts

11 July 2011 at 4:59pm

gravatar.com have added the facility to choose different types of default images (wavatar, identicon, monsterid, standard) if the user/query doesn't have a Gravatar loaded on their service.

I've got the options to show and be stored in the settings tab in the CMS but I'm having trouble accessing the GravatarType from the ForumRole.

in the Forumrole.php I'm calling
<code>
$gravatar = ForumHolder::getGravatarType()
</code>

to try and get/retrieve the setting from the ForumHolder but I don't know if the Member object can know which Forum it is currently looking in or how it can find that out.

<code>
function getGravatartype(){
Debug::dump($this);
      $holder = DataObject::get_by_id("ForumHolder", "{$this}");
   return $holder->GravatarType;
   }
</code>

$this is a Member object and it has no reference to the Forum object I'm trying to check

thanks for any help

Avatar
Willr

Forum Moderator, 5513 Posts

11 July 2011 at 10:47pm

Well the code you have won't work because ForumHolder::getGravatarType() looks to be a static function, so $this won't be set (static after all).

So you'll need to just do a DataObject::get_one('ForumHolder'); I haven't yet devisied a nice way to support multiple forum holders with different settings so as long as you don't have multiple forum holders it'll be fine.

Avatar
wildflower1975

Community Member, 59 Posts

12 July 2011 at 11:31am

I've got a new ForumHolder.php and ForumRole.php to contribute but I can't find anywhere to put it.

http://doc.silverstripe.org/sapphire/en/ links to contributing http://www.silverstripe.org/contributing-to-silverstripe/ which links back to the docs

http://doc.silverstripe.org/sapphire/en/misc/coding-conventions doesn't mention how to connect to open.silverstripe.org - which I suppose is good thing because you don't want people adding to svn/git willy nilly ;)

Avatar
wildflower1975

Community Member, 59 Posts

12 July 2011 at 11:31am

I've got a new ForumHolder.php and ForumRole.php to contribute but I can't find anywhere to put it.

http://doc.silverstripe.org/sapphire/en/ links to contributing http://www.silverstripe.org/contributing-to-silverstripe/ which links back to the docs

http://doc.silverstripe.org/sapphire/en/misc/coding-conventions doesn't mention how to connect to open.silverstripe.org - which I suppose is good thing because you don't want people adding to svn/git willy nilly ;)

Avatar
wildflower1975

Community Member, 59 Posts

12 July 2011 at 11:31am

I've got a new ForumHolder.php and ForumRole.php to contribute but I can't find anywhere to put it.

http://doc.silverstripe.org/sapphire/en/ links to contributing http://www.silverstripe.org/contributing-to-silverstripe/ which links back to the docs

http://doc.silverstripe.org/sapphire/en/misc/coding-conventions doesn't mention how to connect to open.silverstripe.org - which I suppose is good thing because you don't want people adding to svn/git willy nilly ;)

Attached Files
Avatar
Willr

Forum Moderator, 5513 Posts

12 July 2011 at 2:58pm

I've got a new ForumHolder.php and ForumRole.php to contribute but I can't find anywhere to put it.

The docs is the place for the information (you had the right page! http://doc.silverstripe.org/sapphire/en/misc/contributing#submiting-bugfixes-and-enhancements)

You can either fork the module (as mentioned on that page) or submit a patch to open.silverstripe.org (you'll need to register for an account) and select 'New ticket' and file it under the forum module and type = patch.