Customizing SMF > Mod Requests
URL to join a Membergroup from anywhere in the forum.
Yoshi:
--- Quote from: Wilo on March 27, 2012, 10:43:47 AM ---Hi, Thankyou very much for your time.
I've added the code however I get the following
Whoops!
Session verification failed. Please try logging out and back in again, and then try again.
Here's the code i'm entering.
<?php
global $user_info;
if (!in_array(20, $user_info['groups']))
{
echo '<a href="//test_server/index.php?action=profile;save;u=' . $user_info['id'] . ';area=groupmembership;gid=20">Join this group!</a>';
}
else
{
echo '<a href="//test_server/index.php?action=profile;save;u=' . $user_info['id'] . ';area=groupmembership;gid=20">Leave this group!</a>';
}
?>
--- End quote ---
Oh, meh, seems like it doesn't like me removing the phpSessID stuff. Let me test something.
EDIT: Try this:
--- Code: ---<?php
global $user_info;
if (!in_array(20, $user_info['groups']))
{
echo '<a href="//test_server/index.php?action=profile;save;u=' . $user_info['id'] . ';area=groupmembership;' . $_SESSION['session_value'] . ';gid=20">Join this group!</a>';
}
else
{
echo '<a href="//test_server/index.php?action=profile;save;u=' . $user_info['id'] . ';area=groupmembership;' . $_SESSION['session_value'] . ';gid=20">Leave this group!</a>';
}
?>
--- End code ---
Wilo:
Same issue.
Yoshi:
Last try then:
--- Code: ---<?php
global $user_info;
if (!in_array(20, $user_info['groups']))
{
echo '<a href="//test_server/index.php?action=profile;save;u=', $user_info['id'], ';area=groupmembership;', $_SESSION['session_var'], '=', $_SESSION['session_value'], ';gid=20">Join this group!</a>';
}
else
{
echo '<a href="//test_server/index.php?action=profile;save;u=', $user_info['id'], ';area=groupmembership;', $_SESSION['session_var'], '=', $_SESSION['session_value'], ';gid=20">Leave this group!</a>';
}
?>
--- End code ---
Wilo:
That's it!
That is absolutely amazing, I have been searching for a work around for months. While your brain is on fire can your script return to it's origin. When the link is pressed it goes to the membergroup page and joins, or leaves the group. Can the script run in the background so the member remains on the page containing the link?
Thanks again for your help.
W.
Yoshi:
--- Quote from: Wilo on March 27, 2012, 11:35:19 AM ---That's it!
That is absolutely amazing, I have been searching for a work around for months. While your brain is on fire can your script return to it's origin. When the link is pressed it goes to the membergroup page and joins, or leaves the group. Can the script run in the background so the member remains on the page containing the link?
Thanks again for your help.
W.
--- End quote ---
Sure, that's not so hard to do.
Can I have a link to your site, so I can check if jQuery is available?
Because if it is, it would be a lot easier to code for me :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version