View Full Version : Code Help
Colossal31
10-02-2015, 10:09 PM
Tried to make a forum block that signs you up for a usergroup. I have the template set to join the group and the join part works but for some reason it will not redirect to the Usergroup Roster Page i have created for that group. Any help will be appreciated. If need be I can post the code for the template too just to make sure I didnt screw anything in there up.
<a href="/roster.php?roster=EBAFreeAgent" onclick="document.getElementById('EBA').submit();return false;">
<img src='/images/ebasignup/ebasignup.png' width='240px' height='198px' alt=''>
</a>
So when they click on the link, it should submit a form somewhere...?
It's not clear what you exactly want. Might also want to remove "return false;" in the onclick.
Colossal31
10-03-2015, 06:49 PM
So when they click on the link, it should submit a form somewhere...?
It's not clear what you exactly want. Might also want to remove "return false;" in the onclick.
OK the code above is the code for the Forum Block that has a button for them to click on and it puts them in a usergroup. When they click on it, I want it to redirect them to the roster.php?roster=***** page which is just a list of those people. Right now it places them in the usergroup but does not re-direct them to the roster page. Below is the custom html for the block template. I just want it to be click>>assign to usergroup id >>>> redirect to roster page for that usergroup.
<vb:if condition="$GLOBALS[forumid] == 50"><li>
<div class="block smaller">
<div class="blocksubhead">
<a class="collapse" id="collapse_block_html_{vb:raw blockinfo.blockid}" href="{vb:raw relpath}#top"><img alt="" src="{vb:stylevar imgdir_button}/collapse_40b.png" id="collapseimg_html_{vb:raw blockinfo.blockid}"/></a>
<span class="blocktitle">{vb:raw blockinfo.title}</span>
</div>
<div class="widget_content blockbody floatcontainer">
<div id="block_html_{vb:raw blockinfo.blockid}" class="blockrow">
{vb:raw content}
</div>
</div>
</div>
<div class="underblock"></div>
</li>
<form action="profile.php" method="post" id="EBA">
<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />
<input type="hidden" name="do" value="joingroup" />
<input type="hidden" name="usergroupid" value="197" />
</form>
</vb:if>
Colossal31
10-05-2015, 11:00 PM
So does anyone see what I did wrong? I am sure I screwed something up. Just looking for a little help. Basically to break it down again. This forum block is displayed in Sidebar Anywhere on a specific forum. Once the individual clicks on the image they are assigned to UG 197 and should be redirected to a Memberlist page with just that UGs members shown that I have already created. The only part of the process that is not working is the redirect. Removing the return false; from the top code stops the UG Join. If anyone can aide me in figuring out what I did wrong please let me know, because this is driving me bonkers.
John Lester
10-06-2015, 02:50 AM
In your template code for the link ... shouldn't there be a . in front of /roster.php?
squidsk
10-06-2015, 04:03 PM
Or no leading slash.
Colossal31
10-06-2015, 07:35 PM
In your template code for the link ... shouldn't there be a . in front of /roster.php?
Or no leading slash.
Tried both but it still is not redirecting. The join still works but the redirect still fails.
John Lester
10-08-2015, 04:19 AM
Provide a link to the forum where the forum block is and a link to the roster page.
Colossal31
10-08-2015, 11:20 PM
http://www.eliteteamplay.com/forumdisplay.php?50-Elite-Basketball-Association
the forum block is to the right.
http://www.eliteteamplay.com/roster.php?roster=EBAFreeAgent
That is the roster page.
The problem is that the hyperlink has an onclick which submits the form, you can't submit a form and go to a link at the same time. The form has to actually be submitted in order for the form to be processed.
You have to hook into profile_complete and redirect the user to that page when they are sending a request to join a group.
John Lester
10-09-2015, 04:39 AM
Maybe not with html but you can submit a form and do a redirect at the same time in javascript. I just really suck at it and don't know the exact code but I've used it before a couple of years ago in a forumblock of my own. If I had the backups to that forum I'd be able to post what worked, but alas they're long gone :(
Maybe not with html but you can submit a form and do a redirect at the same time in javascript. I just really suck at it and don't know the exact code but I've used it before a couple of years ago in a forumblock of my own. If I had the backups to that forum I'd be able to post what worked, but alas they're long gone :(
It's possible if the form is being submitted using AJAX indeed. Going to be rather tricky in an onclick though.
Colossal31
10-10-2015, 12:29 AM
I appreciate the input atleast I have a direction to work with. I will look at the hook and the js options. In the mean time just gonna hide the block after they click it and have another block with the link to the roster appear. Thanks for all the useful info.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.