Link to join group?

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Suggested Hosts
User avatar
BiggDawgg
Registered User
Posts: 356
Joined: Tue Oct 19, 2004 8:46 am
Location: USA, Illinois
Contact:

Re: Link to join group?

Post by BiggDawgg » Fri Mar 18, 2011 4:29 am

Prolly in header ... but would be great if it would work anywhere I want to put the link / button

User avatar
XelNagah
Registered User
Posts: 14
Joined: Mon Jul 12, 2010 6:40 am

Re: Link to join group?

Post by XelNagah » Fri May 27, 2011 6:01 pm

Hey guys,

As for now, I made a BBCode to join groups. I placed it on our group's forums descriptions in order to offer an easy way for our users to join the groups without having to go to their User Control Panel.

In case you find it useful, the BBCode goes like this:

Usage:

Code: Select all

[gjoin]{NUMBER}[/gjoin]
HTML Replacement:

Code: Select all

<form id="ucp" method="post" target="_blank" action="./ucp.php?i=groups&mode=membership">
<input id="1" type="hidden" name="selected" value="{NUMBER}"  />
<input id="1" type="hidden" name="action" value="join"  />
<input class="button2" id="1" type="submit" name="submit" value="Join Group" />
</form>
Help Line:

Code: Select all

[gjoin]33[/gjoin]
The number passed as the parameter is the group's id number.

Here's an image of how it looks in the forum's descriptions in Chrome:

Image

Where "Ingresar al Grupo" = "Join Group" in spanish ^_^

Xel.-

.m.
Registered User
Posts: 438
Joined: Wed Nov 04, 2009 8:39 pm

Re: Link to join group?

Post by .m. » Fri May 27, 2011 6:18 pm

^ that's brilliant if its working fine :)

User avatar
XelNagah
Registered User
Posts: 14
Joined: Mon Jul 12, 2010 6:40 am

Re: Link to join group?

Post by XelNagah » Sun May 29, 2011 12:47 pm

.m. wrote:^ that's brilliant if its working fine :)
Hey, it does. ^_^ It's not the best solution, but it doesn't imply messing with the code. It's pretty straightforward for anyone.

In case you were wondering how to resign a group with this, the BBCode should be:

Usage:

Code: Select all

[gresign]{NUMBER}[/gresign]
HTML Replacement:

Code: Select all

<form id="ucp" method="post" target="_blank" action="./ucp.php?i=groups&mode=membership">
<input id="1" type="hidden" name="selected" value="{NUMBER}"  />
<input id="1" type="hidden" name="action" value="resign"  />
<input class="button2" id="1" type="submit" name="submit" value="Resign Group" />
</form>
Help Line:

Code: Select all

[gresign]33[/gresign]
Good luck.-

pinkdjinn
Registered User
Posts: 3
Joined: Sat Feb 06, 2010 8:33 am

Re: Link to join group?

Post by pinkdjinn » Sun Mar 11, 2012 11:41 pm

What a good idea :) I stumbled on this yesterday and it would be great for some of the stuff we do.

I did find a few problems with it and thought I'd post the tentative solution I found. I love to know if anyone can see any potential problems with doing it this way.

Problems with BBCode forms:
1) It breaks Preview if you insert form BBCode into into content as you're putting a form inside a form. The result being that Submit won't work.

2) Setting the name of multiple forms to the same thing and the id of every form element to 1 is not valid html. Easy enough the get around by using id="textvar{NUMBER}" where "textvar" is different and not beginning with a numeral for each element.

3) You can end up with forms inside other BBCode generated html tags where they're just not supposed to be.

Solution:
You could use a link instead if you were willing to add one line of code to /includes/ucp/ucp_groups.php.
That file will not proceed if $_POST['submit'] is not set. That's why the $_GET vars in the link idea don't work.

So to cut a long story short and bearing in mind this hasn't been tested on a live site so you should treat it with a large shovel load of salt:

Open: /includes/ucp/ucp_groups.php
Find:

Code: Select all

		$mark_ary	= request_var('mark', array(0));
		$submit		= (!empty($_POST['submit'])) ? true : false;
		$delete		= (!empty($_POST['delete'])) ? true : false;
		$error = $data = array();
After add:

Code: Select all

		// Add Join Group by url
		$submit		= (!$submit && request_var('action', '') == 'join' && request_var('uj', 0)) ? true : $submit;
BBCode:

Code: Select all

[join]{NUMBER}[/join]

Code: Select all

<a class="button" href="./ucp.php?i=groups&mode=membership&action=join&selected={NUMBER}&uj=1">Join Group</a>

Code: Select all

[join]1000[/join]

Locked

Return to “[3.0.x] MOD Requests”