Home Forums Plugin Support WP User Frontend Pro Select Package with Role

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  elenanik 5 years, 6 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #9604

    elenanik
    Participant
    Post count: 20

    Hi, I have a demo website and purchased your plugin to create a front end post for listings.
    I have a question on how to get the select box with my packages and show it on front end. Users select a package and they register with roles. For free package I have the free user role etc.
    as you can see below on the code. Is there a way to call this select on the front end user registration form?

    Thanks a lot!

    <div class="register-role">
    				<label for="directory-role"><?php _e('Package','ait'); ?> </label>
    				<select name="directory-role">
    				<?php
    				global $aitThemeOptions;
    				$currency = (isset($aitThemeOptions->members->paypalCurrencyCode)) ? $aitThemeOptions->members->paypalCurrencyCode : 'USD';
    				for ($i=1; $i <= 5; $i++) {
    					$roleEnable = 'role'.$i.'Enable';
    					$roleName = 'role'.$i.'Name';
    					$rolePrice = 'role'.$i.'Price';
    					if (isset($aitThemeOptions->members->paypalPaymentType) && ($aitThemeOptions->members->paypalPaymentType == 'recurring')) {
    						$periodName = 'role'.$i.'Period';
    						$rolePeriod = __('year','ait');
    						switch ($aitThemeOptions->members->$periodName) {
    							case 'Year':
    								$rolePeriod = __('year','ait');
    								break;
    							case 'Month':
    								$rolePeriod = __('month','ait');
    								break;
    							case 'Week':
    								$rolePeriod = __('week','ait');
    								break;
    							case 'Day':
    								$rolePeriod = __('day','ait');
    								break;
    						}
    					}
    					$free = (trim($aitThemeOptions->members->$rolePrice) == '0') ? true : false;
    					if(isset($aitThemeOptions->members->$roleEnable)){
    						echo '<option value="directory_'.$i.'"'; if($free) { echo ' class="free"'; } echo '>'.$aitThemeOptions->members->$roleName;
    						if(!$free) {
    							if (isset($aitThemeOptions->members->paypalPaymentType) && ($aitThemeOptions->members->paypalPaymentType == 'recurring')) {
    								echo ' - '.trim($aitThemeOptions->members->$rolePrice).' '.$currency.' '.__('per','ait').' '.$rolePeriod;
    							} else {
    								echo ' ('.$aitThemeOptions->members->$rolePrice.' '.$currency.')';
    							}
    						} else {
    							echo ' ('.__('Free','ait').')';
    						}
    						echo '</option>';
    					}
    				}
    				?>
    				</select>
    			</div>
    #9605

    elenanik
    Participant
    Post count: 20

    this is the complete code

    <?php
    function directory_register( $atts ) {
    	$atts = extract( shortcode_atts( array( 'id'=>'ait-dir-register-shortcode' ),$atts ) );
    	ob_start();
    	?>
    	<!-- register -->
    	<div id="<?php echo $id; ?>">
    		<form method="post" action="<?php echo home_url('/?dir-register=register'); ?>" class="wp-user-form" id="ait-dir-item">
    			<div class="register-username">
    				<label for="user_login"><?php _e('Username','ait'); ?> </label>
    				<input type="text" name="user_login" value="" size="20" id="user_login_register_shortcode" tabindex="101" />
    			</div>
    			<div class="register-email">
    				<label for="user_email"><?php _e('Email','ait'); ?> </label>
    				<input type="text" name="user_email" value="" size="25" id="user_email_register_shortcode" tabindex="102" />
    			</div>
                
    <p class="form-password">
                            <label for="pass1"><?php _e('Password *', 'profile'); ?> </label>
                            <input class="text-input" name="pass1" type="password" id="pass1" />
                        </p><!-- .form-password -->
                        <p class="form-password">
                            <label for="pass2"><?php _e('Repeat Password *', 'profile'); ?></label>
                            <input class="text-input" name="pass2" type="password" id="pass2" />
                        </p><!-- .form-password -->
    
    			<div class="register-role">
    				<label for="directory-role"><?php _e('Package','ait'); ?> </label>
    				<select name="directory-role">
    				<?php
    				global $aitThemeOptions;
    				$currency = (isset($aitThemeOptions->members->paypalCurrencyCode)) ? $aitThemeOptions->members->paypalCurrencyCode : 'USD';
    				for ($i=1; $i <= 5; $i++) {
    					$roleEnable = 'role'.$i.'Enable';
    					$roleName = 'role'.$i.'Name';
    					$rolePrice = 'role'.$i.'Price';
    					if (isset($aitThemeOptions->members->paypalPaymentType) && ($aitThemeOptions->members->paypalPaymentType == 'recurring')) {
    						$periodName = 'role'.$i.'Period';
    						$rolePeriod = __('year','ait');
    						switch ($aitThemeOptions->members->$periodName) {
    							case 'Year':
    								$rolePeriod = __('year','ait');
    								break;
    							case 'Month':
    								$rolePeriod = __('month','ait');
    								break;
    							case 'Week':
    								$rolePeriod = __('week','ait');
    								break;
    							case 'Day':
    								$rolePeriod = __('day','ait');
    								break;
    						}
    					}
    					$free = (trim($aitThemeOptions->members->$rolePrice) == '0') ? true : false;
    					if(isset($aitThemeOptions->members->$roleEnable)){
    						echo '<option value="directory_'.$i.'"'; if($free) { echo ' class="free"'; } echo '>'.$aitThemeOptions->members->$roleName;
    						if(!$free) {
    							if (isset($aitThemeOptions->members->paypalPaymentType) && ($aitThemeOptions->members->paypalPaymentType == 'recurring')) {
    								echo ' - '.trim($aitThemeOptions->members->$rolePrice).' '.$currency.' '.__('per','ait').' '.$rolePeriod;
    							} else {
    								echo ' ('.$aitThemeOptions->members->$rolePrice.' '.$currency.')';
    							}
    						} else {
    							echo ' ('.__('Free','ait').')';
    						}
    						echo '</option>';
    					}
    				}
    				?>
    				</select>
    			</div>
    			<div class="login-fields">
    				<?php do_action('register_form'); ?>
    				<input type="submit" name="user-submit" value="<?php _e('Sign up!', 'ait'); ?>" class="user-submit" tabindex="103" />
    		<input type="hidden" name="user-cookie" value="1" />
    			</div>
    		</form>
    
    		</div>
    				
    	<script>
    	jQuery(document).ready(function($) {
    		var tabRegisterShortcode = $('#<?php echo $id; ?>'),
    			selectShortcode = tabRegisterShortcode.find('select[name=directory-role]'),
    			buttonSubmitShortcode = tabRegisterShortcode.find('input[name=user-submit]'),
    			freeTitleShortcode = '<?php _e('Sign up','ait'); ?>',
    			buyTitleShortcode = '<?php _e('Buy with PayPal','ait'); ?>';
    		if(selectShortcode.find('option:selected').hasClass('free')){
    			buttonSubmitShortcode.val(freeTitleShortcode);
    		} else {
    			buttonSubmitShortcode.val(buyTitleShortcode);
    		}
    		selectShortcode.change(function(event) {
    			if(selectShortcode.find('option:selected').hasClass('free')){
    				buttonSubmitShortcode.val(freeTitleShortcode);
    			} else {
    				buttonSubmitShortcode.val(buyTitleShortcode);
    			}
    		});
    	});
    	</script>
    	<?php
    	$output = ob_get_contents();
    	ob_end_clean();
    
    	return $output;
    }
    add_shortcode( "directory_register", "directory_register" );
    
    #9618

    Tareq Hasan
    Keymaster
    Post count: 2831

    Hello Elena, I think you need action hook, take a look about how to use this.

    #9623

    elenanik
    Participant
    Post count: 20

    I need your help if you can,
    I want to get rid of the button and add mine button to the registration form.

    In my demo site here –> http://lemon-ad.gr/directory/package/

    I want to add in the registration form I created with your plugin the package select and the button.
    If you select a package with payment this button changes to “buy with paypal”, if you select the free package the button changes to “sign up”

    So far, I created the form with action hook to get the select box with packages and I don't know what to do with the button.

    Can you please help me? I really need your HELP!!! I am new to wordpress 🙂

    you can see my progress in this page I created with your awesome, fantastic plugin!
    http://lemon-ad.gr/directory/step2/

    I was searching for long time for a plugin like that and a user in the template forum told to use your plugin!!!

    Thanks!

    On 30 Οκτ 2013, at 8:48 μ.μ., weDevs Team wrote: > Tareq Hasan wrote:

    Hello Elena, I think you need action hook, take a look about how to use this
    [0].

    #9816

    elenanik
    Participant
    Post count: 20

    anyone? can you please help me? I need your help 🙂
    Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Select Package with Role’ is closed to new replies.