Found a simple solution to a login & redirect problem, where aMember 4 & vBulletin 4.2 share an integrated login. There is an option in vBulletin to send a notification email whenever a private message (between forum members) is received. However when you click on the email's URL link back to the login page to pickup and view the new private message, you are taken to vBulletin's login rather than aMembers login, which confuses your customers. Far better to have a single login screen for clarity and keep this as aMembers. There is a simple solution to this problem by using aMembers built in URL redirect on login feature. For Example: vBulletin Private Message Notification Email: To read the original version, respond to, or delete this message, you must log in here: http://www.youramembersite.com/forums/private.php Just edit the vBulletin email template to modify the private message login URL to be... http://www.youramembersite.com/members/login/?amember_redirect_url=/forums/private.php Where the amember_redirect_url can be any destination you choose. Hope this helps someone with the same setup & issue. Aly
Have developed a more comprehensive solution as time showed a need. There are two parts to the expanded fix. You have to reapply the back-end hack after every vBulletin upgrade but the front-end modification remains good between upgrades: 1. Back-end vBulletin function code hack 2. Front-end vBulletin Email Body Text Phrases Modification 1. Back-end vBulletin function code hack The new fix to the problem is a vBulletin code function hack to deal with long URL's containing more than one (question mark) '?' character. More than one ? character in an email hyperlink, causes the aMember login URL redirect to fail, as the function can only parse the one ? sign not two or more. The unsubscribe links in the emails often had two or more ? characters. For example, here is a typical vBulletin email unsubscribe link from a forum thread, having two ? characters in the link: To unsubscribe from this thread, please visit this page: http://www.yourwebsite.com/members/...onid=12&auth=4f21614ec6b710354ca3d3e05e99dee9 Thanks to the aMember support team for pointing me in the right direction with a PHP fuction urlencode.php to escape out the characters in the hyperlinks turning them into (percentage signs) '%'. http://ru2.php.net/manual/en/function.urlencode.php I tried to find a solution which wouldn't require a back-end code hack but couldn't see one, the only place you can apply the urlencode.php function is in the backend vBulletin functions code. Here are the functions you need to update, which will require a manual re-application of the fix every time you update vBulletin (the big disadvantage) but its the only way I could find. .../ indicates the vBulletin install directory. .../includes/functions_digest.php .../includes/functions_newpost.php The code in blue text is the urlencode.php applied to the unsubscribe links after vBulletin has formed them, escaping out the ? to % characters, thus making the links able to be parsed by aMember's login URL redirect function. .../includes/functions_digest.php PHP: //magic phrases for thread eval below. $threadlink = fetch_seo_url('thread|nosession|bburl', array('threadid' => $threadinfo['threadid'], 'title' => htmlspecialchars_uni($threadinfo['title'])), array('goto' => 'newpost')); $unsubscribelink = fetch_seo_url('subscription|nosession|bburl|js', array(), array( 'do' => 'removesubscription', 'type' => 'thread', 'subscriptionid' => $touser['subscribethreadid'], 'auth' => $touser['auth'], )); [COLOR=#0000ff] $unsubscribelink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail[/COLOR] $managesubscriptionslink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'viewsubscription', 'folderid' => 'all')); [COLOR=#0000ff] $managesubscriptionslink = urlencode($unsubscribelink); [/COLOR][COLOR=#0000ff]// Escape out the ? characters causing aMember redirect to fail[/COLOR] .../includes/functions_newpost.php PHP: //magic vars used in the phrase eval below. $pagetext = $pagetext_cache["$touser[languageid]"]; $discussionlink = fetch_seo_url('groupdiscussion|nosession|bburl|js', $discussion, array('goto' => 'newpost')); $unsubscribelink = fetch_seo_url('grouphome|nosession|bburl|js', array(), array('do' => 'unsubscribe', 'subscriptionid' => $touser['subscribediscussionid'], 'auth' => $touser['auth'])); [COLOR=#0000ff] $unsubscribelink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail[/COLOR] $managegroupsubscriptionslink = fetch_seo_url('groupsub|nosession|bburl|js', array()); [COLOR=#0000ff] $managegroupsubscriptionslink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail[/COLOR] $managesubscriptionslink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'viewsubscription', 'folderid' => 'all')); [COLOR=#0000ff] $managesubscriptionslink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail[/COLOR] 2. Front-end Email Body Text Phrases Modification The concept is the same as the first part of this thread, yet expanded across more of the 'Email Body Text Phrases' where vBulletin send emails with links back to the website. You need to add the aMember login URL redirect to the following templates, at least for my setup. You can use the same idea to add the URL redirect to any email template inside vBulletin to suit your own setup needs. While logged into vBulletin's Admin Control Panel Select the menu > Languages & Phrases > Phrase Manager Under 'Phrase Type' select 'Email Body Text' The next two screen shots show the 'Email Body Text Phrases' that I chose to modify, shown with a check-mark next to their names. Click Edit > digestforum (or whichever email template you wish to modify) Add in the aMember login URL redirect before the $variables that give the vBulletin website link paths to forums, threads & unsubscribe links. Save the new translation. When the email is sent the aMember login URL redirect is prefixed to the link variable values.
In the code samples above I tried to apply a blue color which introduced bad tags in the code samples, just ignore them [COLOR=#0000ff] [/COLOR] Here's what you need $unsubscribelink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail
For those who can't see the screen shots (not aMember members) here is a list of the email body text phrase templates to edit: digestforum digestgroup digrestgroupbit digestpostbit digestthread digestthreadbit moderator notify notify_discussion pmboxalmostfull pmboxfull pmreceived reminder reminderbit welcompm There are likely to be other email templates depending on your setup, the concept of prefixing the $variable is the same whichever template you use. Here is the replacement text for the digestforum Dear $forum[username], You are subscribed to the forum $forum[title_clean], there have been $newthreads new thread(s) and $updatedthreads updated thread(s). http://www.yourwebsitename.com/members/login/?amember_redirect_url=$forumlink The following threads are new: $newthreadbits The following threads have been updated: $updatedthreadbits All the best, $vboptions[bbtitle] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Unsubscription information: To unsubscribe from this forum, please visit this page: http://www.yourwebsitename.com/members/login/?amember_redirect_url=$unsubscribelink
Forgot one more of the back-end vBulletin functions to update. ../includes/functions_socialgroup.php PHP: //magic vars used in the phrase eval below. $pagetext = $pagetext_cache["$touser[languageid]"]; $discussionlink = fetch_seo_url('groupdiscussion|nosession|bburl|js', $discussion, array('goto' => 'newpost')); $unsubscribelink = fetch_seo_url('grouphome|nosession|bburl|js', array(), array('do' => 'unsubscribe', 'subscriptionid' => $touser['subscribediscussionid'], 'auth' => $touser['auth'])); $unsubscribelink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail $managegroupsubscriptionslink = fetch_seo_url('groupsub|nosession|bburl|js', array()); $managegroupsubscriptionslink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail $managesubscriptionslink = fetch_seo_url('subscription|nosession|bburl|js', array(), array('do' => 'viewsubscription', 'folderid' => 'all')); $managesubscriptionslink = urlencode($unsubscribelink); // Escape out the ? characters causing aMember redirect to fail