suitedconnector
Forum Replies Created
-
Any thoughts on that code?
I used this code in the Code Snippets plugin:
/*
- Allow members to upload their avatar using a Register Helper field during checkout or on the Member Profile Edit page.
* - Requires: Paid Memberships Pro, Register Helper Add On.
* - You can add this recipe to your site by creating a custom plugin
- or using the Code Snippets plugin available for free in the WordPress repository.
- Read this companion article for step-by-step directions on either method.
- https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
// Filter the saved or updated User Avatar meta field value and add the image to the Media Library.
function my_updated_user_avatar_user_meta( $meta_id, $user_id, $meta_key, $meta_value ) {
// Change user_avatar to your Register Helper file upload name.
if ( ‘user_avatar’ === $meta_key ) {
$user_info = get_userdata( $user_id );
$filename = $meta_value[‘fullpath’];
$filetype = wp_check_filetype( basename( $filename ), null );
$wp_upload_dir = wp_upload_dir();
$attachment = array(
‘post_mime_type’ => $filetype[‘type’],
‘post_title’ => preg_replace( ‘/.[^.]+$/’, ”, basename( $filename ) ),
‘post_status’ => ‘inherit’,
);
$attach_id = wp_insert_attachment( $attachment, $filename );
// Make sure that this file is included, as wp_generate_attachment_metadata() depends on it.
require_once ABSPATH . ‘wp-admin/includes/image.php’;
$attach_data = wp_generate_attachment_metadata( $attach_id, $filename );
wp_update_attachment_metadata( $attach_id, $attach_data );
update_user_meta( $user_id, ‘wp_user_avatar’, $attach_id );
}
}
add_action( ‘added_user_meta’, ‘my_updated_user_avatar_user_meta’, 10, 4 );
add_action( ‘updated_user_meta’, ‘my_updated_user_avatar_user_meta’, 10, 4 );// Filter the display of the the get_avatar function to use our local avatar.
function my_user_avatar_filter( $avatar, $id_or_email, $size, $default, $alt ) {
$my_user = get_userdata( $id_or_email );
if ( ! empty( $my_user ) ) {
$avatar_id = get_user_meta( $my_user->ID, ‘wp_user_avatar’, true );
if ( ! empty( $avatar_id ) ) {
$avatar = wp_get_attachment_url( $avatar_id, $size );
$avatar = ““;
}
}
return $avatar;
}
add_filter( ‘get_avatar’, ‘my_user_avatar_filter’, 20, 5 );// Add the User Avatar field at checkout and on the profile edit forms.
function my_pmprorh_init_user_avatar() {
//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(
‘user_avatar’, // input name, will also be used as meta key
‘file’, // type of field
array(
‘label’ => ‘Member Avatar’,
‘hint’ => ‘Please upload a photo for your Staff Member account profile. The recommended size is 200px X 200px.’,
‘profile’ => true, // show in user profile
‘preview’ => true, // show a preview-sized version of the image
‘addmember’ => true,
‘allow_delete’ => true,
‘levels’ => array(5)
)
);//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 ); }
}
add_action( ‘init’, ‘my_pmprorh_init_user_avatar’ );Anyone?
I skipped the levels page url by entering the url of the checkout page for the specific membership level. I see that redirection can be added with
<a href="!!login_page_url!!?redirect_to=!!referrer!!">Log In</a>
but since this is not login but registration how can i add the referrer to the checkout page url so i can redirect the member back to the content page? This is what I’m using from the restricted content page:
<a href="/membership-account/account-registration/?level=1?">Register Now</a></div>
- This reply was modified 3 years, 7 months ago by suitedconnector.
Is there some way to replace levels_page_url with the string for the checkout page for level 1 so I can skip the levels page?
This is what I am using in the restricted area:
<div class=”restricted”><span style=”color:red”>This content is restricted.</span> To gain secure access to this page please register for a free account.<br />
Register Now</div>I don’t have the Plus version. Will the code snippet enable me to implement this or do I have to do anything else? I used the code snippet but I don’t see anything changed on the Membership Checkout page.
I would like to either add the member signup directly to the post or have the post restriction redirect the user to the Membership Checkout page (Skipping the Membership Levels page).
Forum: Plugins
In reply to: [WP Import Export Lite] How can I export/import passwordsOkay, I emailed and still waiting…
Do I need to have a license to be able to imort this data? I downloaded the free version.
Forum: Fixing WordPress
In reply to: Shortcode in template builder WP 5.8WTF? I just tried it and shortcodes are not rendering. FAIl.
Where would I add this code?
<?php echo get_post_meta($post->ID, ‘key’, true); ?>
Forum: Plugins
In reply to: [Passster - Password Protect Pages and Content] Custom Posts@patrickposner Thanks for your reply
Please check this video > https://youtu.be/BQMM7J7SuHA
I’m not sure which code to copy.
Forum: Themes and Templates
In reply to: [Blocksy] How to create custom archive layout for BlocksyDo you have tutorial of how to add WP (regular) custom fields in the post template?
Forum: Plugins
In reply to: [PPWP - Password Protect Pages] Password does not unlock protected postMy website just sent me this email:
Error Details
=============
An error of type E_COMPILE_ERROR was caused in line 17 of the file /home/vroutlet/mylandcash.com/wp-content/plugins/password-protect-page/includes/views/meta-box/view-ppw-meta-box.php. Error message: Cannot redeclare ppw_free_feature_set_password_in_meta_box() (previously declared in /home/vroutlet/mylandcash.com/wp-content/plugins/password-protect-page/includes/views/meta-box/view-ppw-meta-box.php:17)The data that I want is entered into a form. Could I simply view the populated results of the form and copy that html content from the inspector? Do you have a tutorial for this?
- Allow members to upload their avatar using a Register Helper field during checkout or on the Member Profile Edit page.