Support » Plugin: Paid Memberships Pro » File Upload help?

  • Resolved rwilki


    I’m using the code from your register-helper plugin and it works for everything except I can’t figure out the file upload field. I’m guessing that I have to create a directory or have it upload off-site, but I cannot find documentation anywhere.

    Here’s the code I’m using:

    $resume = new PMProRH_Field("resume", "file", array("profile"=>true, "options"=>array()));
    pmprorh_add_registration_field("after_email", $resume);


Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Great H-master


    Hello! Thank you for using Paid Memberships Pro. This behavior could be due to server folder permissions on your hosting. Try to “chmod 777” -R the permissions on your WordPress uploads directory (… wp-content/uploads/) and see if it works.

    Let us know what you find. Please change the permissions back to something more restrictive when you have completed testing, since “777” gives blanket access to any user. Thanks again.

    Nope. This didn’t help but thanks for the idea. I’m kind of glad it wasn’t a permission thing, because 777 is not a good idea.

    Anyway, this is what I’m getting:
    Fatal error: Using $this when not in object context in /home/xxxxx/xxxxxx/wp-content/plugins/pmpro-register-helper-master/classes/class.field.php on line 121

    Plugin Author messica


    Hey there,

    Could you please post a sample of your code, including the entire function declaration? Your code looks like it should work fine on first glance but maybe a better look would help.

    The Register Helper should actually be creating a folder in your wp-uploads folder with each of your users’ uploads, so no, you don’t need to do anything to configure that manually.


    thanks Jessica. what code do you want to see? Do you want to see the file “pmpro-register-helper.php” that I’ve edited?

    Here’s the file:

    Plugin Author Great H-master


    Hello. Thank you for using Paid Memberships Pro. It appears you are editing the Register Helper plugin directly. The Register Helper is designed to work in conjunction with a separate plugin which contains your separate fields. Try the following…

    1)Re-download and install the Register Helper without the modifications
    2)Try downloading and installing the sample Register Helper Customization example plugin found here:

    Just to be clear there are 2 plugins involved here: The Register Helper and a separate plugin with your customizations like #2 above. Let us know if this works. Thanks again.

    Hi Great H-Master. thanks for your idea. Still getting the same error. I created the customization as a plugin and as an init in the functions file, but I’m getting the exact same error.

    Fatal error: Using $this when not in object context in /home/xxxxx/xxxxxx/wp-content/plugins/pmpro-register-helper-master/classes/class.field.php on line 121

    I feel like there’s a conflict or it’s a synatx issue…

    Plugin Author messica


    Sorry for the confusion, but are you saying you that you created a separate plugin, and added it into functions.php as well?

    All you need to do is add your code to one OR the other, not both. The lines are here: should be wrapped in your own custom function, which should be hooked into init.. so either your active theme’s functions.php file OR custom plugin (not both!) should contain something like this:

    function my_custom_fields() {
       // your code
    add_action('init', 'my_custom_fields');

    Hope that helps!

    Plugin Author messica


    Additionally, it is not very good practice to reuse the same variable names for your fields ($text and $html in your case). It shouldn’t break anything because you keep adding the new fields after declaring each one but it can definitely get confusing and messy. As Harsha mentioned above, you might want to try just copying and pasting the example code here and edit it to suit your needs.

    Thanks Jessica. I appreciate your advice about not reusing the same variable. So, you’re suggesting I group together all my $text fields into the same declaration? I will do that.

    BTW I have the register helper active untouched, and this is my customizations plugin. I’m not using the function init. Still getting the fatal error.

    function my_pmprorh_init()
    	$text = new PMProRH_Field("occupation", "text", array("size"=>40, "class"=>"occupation", "profile"=>true, "required"=>true));
    	pmprorh_add_registration_field("after_email", $text);
    	$text = new PMProRH_Field("employer", "text", array("size"=>40, "class"=>"employer", "profile"=>true, "required"=>true));
    	pmprorh_add_registration_field("after_email", $text);
    	$text = new PMProRH_Field("position", "text", array("size"=>40, "class"=>"position", "profile"=>true, "required"=>true));
    	pmprorh_add_registration_field("after_email", $text);
    	$history = new PMProRH_Field("history", "textarea", array("rows"=>10, "label"=>"In the space below..."));
    	pmprorh_add_registration_field("after_email", $history);
    	$html = new PMProRH_Field("uploadresume", "html", array("html"=>"<p>Or submit your resume below</p>"));
    	pmprorh_add_registration_field("after_email", $html);
    	$resume = new PMProRH_Field("resume", "file", array("profile"=>true, "options"=>array()));
    	pmprorh_add_registration_field("after_email", $resume);
    	$html = new PMProRH_Field("account", "html", array("html"=>"<p>Please enter a secure password for future access</p>"));
    	pmprorh_add_registration_field("after_password", $html);
    add_action("init", "my_pmprorh_init");

    I removed the “php” and your slug at the top… for this post.

    Fixed thanks to Jason!!! So pumped. Such a great plugin!
    For anyone else who has this problem…


Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘File Upload help?’ is closed to new replies.