Skip to:
Content
Pages
Categories
Search
Top
Bottom

creating custom link

  • @tsabar

    Participant

    (reposting here after posted this in another forum several days ago to no response, hoping this forum is more appropriate)

    hi all, can anyone help me with the following?
    -latest versions of wp, buddypress

    i am trying to create a one-click registration link for events on my site, and i need help inserting the user’s first/last name and e-mail into the link.

    here’s the link before outputting first name/last name/email:

    a href=”http://gowoa.me/i/XXX?email=[EMAIL_ADDRESS_HERE]&firstName=[FIRST_NAME_HERE]&lastName=[LAST_NAME_HERE]”>Register Now /a>
    (i removed opening tags so the code would show as is)

    how can i output the buddypress user variables into the link?

    thanx in advance for any help!

Viewing 14 replies - 1 through 14 (of 14 total)
  • @henrywright

    Moderator

    Hi @tsabar

    You’ll need to insert the variables using PHP. So for example, if your variable is $email and you want to insert it into the link, you’d do it like this:

    a href=”http://gowoa.me/i/XXX?email=<?php echo $email; ?>&firstName=[FIRST_NAME_HERE]&lastName=[LAST_NAME_HERE]”>Register Now /a>
    (i removed opening tags so the code would show as is)

    @tsabar

    Participant

    right, thanx, but how can i get the buddypress variables for first name and last name? here’s the registration page users fill out:

    http://bit.ly/1Dkzqnu

    @henrywright

    Moderator

    Can you post your code here?

    @tsabar

    Participant

    sure, which code are you referring to?

    thanx for your help

    @henrywright

    Moderator

    Your registration page code which you linked to.

    @tsabar

    Participant
    				<div class="register-section" id="profile-details-section">
    					<h4>Profile Details</h4>
    						<div class="editfield field_1 field_first-name required-field visibility-public field_type_textbox">
    		<label for="field_1">
    			First Name							(required)					</label>
    		<input id="field_1" name="field_1" type="text" value="" aria-required="true" >
    										<p class="field-visibility-settings-notoggle" id="field-visibility-settings-toggle-1">
    									This field can be seen by: <span class="current-visibility-level">Everyone</span>								</p>
    						</div>
    
    						<div class="editfield field_15 field_last-name required-field visibility-public alt field_type_textbox">
    		<label for="field_15">
    			Last Name							(required)					</label>
    		<input id="field_15" name="field_15" type="text" value="" aria-required="true" >
    										<p class="field-visibility-settings-toggle" id="field-visibility-settings-toggle-15">
    									This field can be seen by: <span class="current-visibility-level">Everyone</span> <a href="#" class="visibility-toggle-link">Change</a>
    								</p>
    
    								<div class="field-visibility-settings" id="field-visibility-settings-15">
    									<fieldset>
    										<legend>Who can see this field?</legend>
    										<ul class="radio">
    					<li class="public">
    					<label for="see-field_15_public">
    						<input type="radio" id="see-field_15_public" name="field_15_visibility" value="public"  checked='checked' />
    						<span class="field-visibility-text">Everyone</span>
    					</label>
    					</li>
    				
    					<li class="adminsonly">
    					<label for="see-field_15_adminsonly">
    						<input type="radio" id="see-field_15_adminsonly" name="field_15_visibility" value="adminsonly"  />
    						<span class="field-visibility-text">Only Me</span>
    					</label>
    					</li>
    				
    					<li class="loggedin">
    					<label for="see-field_15_loggedin">
    						<input type="radio" id="see-field_15_loggedin" name="field_15_visibility" value="loggedin"  />
    						<span class="field-visibility-text">All Members</span>
    					</label>
    					</li>
    				
    					<li class="friends">
    					<label for="see-field_15_friends">
    						<input type="radio" id="see-field_15_friends" name="field_15_visibility" value="friends"  />
    						<span class="field-visibility-text">My Friends</span>
    					</label>
    					</li>
    			</ul>
    									</fieldset>
    									<a class="field-visibility-settings-close" href="#">Close</a>
    								</div>
    							
    							<p class="description"></p>
    						</div>
    

    @tsabar

    Participant

    i hope that’s what you meant… ?

    @henrywright

    Moderator

    Just looked over the code you’ve posted. That doesn’t really help. That’s just the code to display the registration form for the user to complete when signing up.

    @tsabar

    Participant

    sorry for the noob mistakes, which code were you asking for?

    @henrywright

    Moderator

    I just wanted to see the code you linked to. I try to avoid visiting bit.ly links when posted in forums as who knows what lives there 🙂

    Where abouts are you using the link you’re trying to create?

    @tsabar

    Participant

    on my wordpress/buddypress site i want to offer webinars that users can register to with one-click using a properly formatted link, basically just need to know how to output the first and last name buddypress variables from the registration form, like you showed me above with the email address…

    @henrywright

    Moderator

    How exactly you get the first and last name variables depends on the context in which you’re using the link. It’s important to state, the variables aren’t always available.

    Some examples, when the user clicks submit, you could access the first name and last name server side via $_POST variables. $_POST['field_1'] for first name and $_POST['field_15'] for last name (according to your registration form markup). Alternatively, after the information has been saved to the database, you’ll be able to access the member’s first and last name via functions made available by BP such as bp_core_get_user_displayname()

    Hope this helps

    @tsabar

    Participant

    i’ll need to pull it from the database like bp_core_get_user_displayname(), but the first and last name are custom fields i created in the buddypress registration form (http://www.cbtnest.com/img/regfields.jpg), how/where can i find out what those variables are named?

    @henrywright

    Moderator

    To get the info separately (first name and then last name) you’d have to a) query the database using MySQL or b) see if BuddyPress has functions to do this for you.

    Regarding b, I’m not sure if there is anything like that available. Perhaps someone else here will know?

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘creating custom link’ is closed to new replies.
Skip to toolbar