Support » Plugin: Paid Memberships Pro - Register Helper Add On » Where to put just_profile

  • Resolved Osisis

    (@osisis)


    I have fields that I only want to show up on the profile page. I know I can just just_profile for this, but where in the code am I specifying just_profile? None of your support articles touch on how to use the “8 locations”. They just say you can use them.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Osisis

    (@osisis)

    Adding to this, it would be extremely helpful if you had at least one example for each type and not just recommend people pay $200 to $300 to get hands on help. This is a client site and I can guarantee they are not going to approve that for their project.

    yewzy

    (@yewzy)

    Hi @osisis , I’m just a regular user or PM Pro and not from support. But I believe I’m able to answer your query.

    If you just want the field to appear on the user’s profile page, you can add 'profile' => true, in the field array.

    You have a few options though if you want to restrict the visibility of the field. If you use 'profile' => 'admin', it will only be visible to the admin and not to the user after they’ve submitted it. A good example would be for affiliate codes.

    If you use 'profile => 'only', it won’t be shown to the user during checkout, and only on the profile page.

    Here is the documentation if you would like to know more: https://www.paidmembershipspro.com/documentation/register-helper-documentation/adding-fields/

    Here is the video demonstrating it by the PMPro team: https://www.youtube.com/watch?v=VVTHYPQpfZ4

    Here is the full code example:

    <?php
    /*
     * Example Register Helper fields for Company, Referral Code, and Budget.
     *
     */
    
    // We have to put everything in a function called on init, so we are sure Register Helper is loaded.
    function my_pmprorh_init() {
    	// Don't break if Register Helper is not loaded.
    	if ( ! function_exists( 'pmprorh_add_registration_field' ) ) {
    		return false;
    	}
    
    	// Define the fields.
    	$fields = array();
    	$fields[] = new PMProRH_Field(
    		'company',							// input name, will also be used as meta key
    		'text',								// type of field
    		array(
    			'label'		=> 'Company',		// custom field label
    			'size'		=> 40,				// input size
    			'class'		=> 'company',		// custom class
    			'profile'	=> true,			// show in user profile
    			'required'	=> true,			// make this field required
    			'levels'		=> array(1,2)	// only levels 1 and 2 should have the company field
    		)
    	);
    
    // Add the fields into a new checkout_boxes are of the checkout page.
    	foreach ( $fields as $field ) {
    		pmprorh_add_registration_field(
    			'checkout_boxes',				// location on checkout page
    			$field							// PMProRH_Field object
    		);
    	}
    
    	// That's it. See the PMPro Register Helper readme for more information and examples.
    }
    add_action( 'init', 'my_pmprorh_init' );

    I hope that it was helpful. 🙂

    • This reply was modified 5 months ago by yewzy.
    Thread Starter Osisis

    (@osisis)

    @yewzy This is the page I need. There are so many pages for this plugin, but they don’t have this. Thank you so very much!

    Thread Starter Osisis

    (@osisis)

    Just marking resolved.

    You’re very welcome. Yes I do agree that the documentation for register helper can be further improved and tidied up.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.