Clickable Member Group to a URL

Started by kizer, August 12, 2008, 01:48:05 PM

Previous topic - Next topic

kizer

Im playing with the Subscription Mod and asked a little question however I think it might be a little beyond the scope so I figured why not ask it here so this is the coding area.
http://www.simplemachines.org/community/index.php?topic=105532.msg1657442#msg1657442

This is what I asked

I created a group called Site Supporter
I created a little image that looks like a gift that is displayed for that group.

Is it possible to make the gift clickable and send the clicker to their Subscription URL for their particular account? The reason behind my thinking is somebody is going to be curious to what that image is when they click on it, it will take them to their Subscription page so they can make the decision to subscribe or not to subscribe. The more that might see it the more that might subscribe as well.

Looking at the URL for the Subscription mod it would be. ****=members ID of course.
http://www.url-here.com/forum/index.php?action=profile;u=****;sa=subscriptions
Own a Jeep? Links4Jeeps.com

[SiNaN]

Do you want this just in profile info shown in posts?
Former SMF Core Developer | My Mods | SimplePortal

kizer

Yes. So if I had a gift image in my profile in my post and the member sees it they would click on it and it would take them to their profile in their Subscriptions area.

Thank you [SiNaN]  for asking and entertaining the idea. If not and just clarifying I thank you for that as well. ;)
Own a Jeep? Links4Jeeps.com

[SiNaN]

Okay.

../Themes/your_theme/Display.template.php

Find:

// Is karma display enabled?  Total or +/-?

To make it for every user:

Replace:

// Gift thing...
echo '<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], ';sa=subscriptions"><img src="' . $settings['images_url'] . 'gift.gif" alt="gift" /></a><br />';

// Is karma display enabled?  Total or +/-?


For just one group:

// Gift thing...
if($message['member']['group_id'] == 'ID_GROUP')
echo '<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], ';sa=subscriptions"><img src="' . $settings['images_url'] . 'gift.gif" alt="gift" /></a><br />';

// Is karma display enabled?  Total or +/-?


'ID_GROUP' should be changed as the ID of group that you want to show it for.

For just one member:

// Gift thing...
if($message['member']['id'] == 'ID_MEMBER')
echo '<a href="', $scripturl, '?action=profile;u=', $message['member']['id'], ';sa=subscriptions"><img src="' . $settings['images_url'] . 'gift.gif" alt="gift" /></a><br />';

// Is karma display enabled?  Total or +/-?


'ID_MEMBER' should be changed as the ID of member that you want to show it for.

It will look for the ../Themes/your_theme/images/gift.gif image.
Former SMF Core Developer | My Mods | SimplePortal

kizer

[SiNaN]

Thank you I'll give it a try this after noon. As well if its good to go I'll drop a note in the Subscription Mod area just in case there are others that are interested in this idea.
Own a Jeep? Links4Jeeps.com

[SiNaN]

Okay, inform us about the result so that we can mark the topic as solved. ;)
Former SMF Core Developer | My Mods | SimplePortal

kizer

Using the Group code.

Ok two things real quick.

I wanted the person who clicked on the image to be sent to "their profile" not the profile of the person they clicked on the image for. Meaning. If Member A is a site supporter and B sees it in their profile. B is interested and clicks on the image sending Member B to Member B's Profile.

Also when you look at the image its broken with this as its URL.
http://www.mydomain.com/forum/Themes/default/imagesgift.gif

looks like its missing the / after images, but for the life of me I can't figure out where to change it.
Own a Jeep? Links4Jeeps.com

kizer

I added a / in front of the image in the display template to fix it and the image shows. Probably not the correct way, but it does work. ;)
Own a Jeep? Links4Jeeps.com

kizer

I did notice if I remove the members id from the subscription URL it takes me to my own, which is what I wanted, but I don't know if its 100% all the time going to work if using the ID says OK, its not your profile you want to look at, but somebody elses.

This takes me to my own from the looks of it.
http://www.mydomain.com/forum/index.php?action=profile;sa=subscriptions

Works here too when I change the url to match simplemachines.org URL.

Looks like I might have my problem solved after all. ;)

Thanks for the help and the direction.
Own a Jeep? Links4Jeeps.com

[SiNaN]

For the image;

You're right, I forgot that slash there.

For the profile;

You're again right. Removing u='ID_MEMBER' would take the viewer to his profile.

I just thought that, that's something to send a gift to the owner of the post.

Anyway, glad you get it solved. And I marked the topic as solved. ;)
Former SMF Core Developer | My Mods | SimplePortal

Cory94bailly

Sorry for a bump but what was your final code?

kizer

Sorry didn't see this but here you go.

Find:
// Is karma display enabled? Total or +/-?

Before:
// Gift thing...
if($message['member']['group_id'] == '123')
echo '<p><a href="', $scripturl, '?action=paypal"><img src="' . $settings['images_url'] . '/l4jsupporter.gif" alt="Forum Supporter" Height="15"/></a><br /><p>';


Now if your going to have more than one group say one is for supporters and one is for vendors like mine you would add an additional line of the above code and change the "group_id==xxxx"

Either way remember you need to change the 123 listed in my group_id to your selected group number because mine just happens to be 123 as the group number. ;)
Own a Jeep? Links4Jeeps.com

Advertisement: