Josh68
Forum Replies Created
-
Forum: Plugins
In reply to: [WP-Members Membership Plugin] Issue filed for wpmem_login_failed_argsThanks for responding, Chad, and for the great plugin.
Sorry for the erroneous ticket, and yes, the documentation was what was confusing me me. Having worked with several similar filters for this plugin (e.g., wpmem_login_form_args), I’ve been including
$args
as an argument, and assumed I was modifying and returning that array. I think I need to check back through my code to be sure I’m using all the_args
filters correctly. This was the first case in which I was getting an error from passing that parameter.For example, wpmem_login_form_args documentation says it’s taking in
$args
and returning a modified array. Now I think this is also wrong. Is there (or should there be) a standard API for all of these types of filters?EDIT: Now I went back and put a breakpoint in wpmem_msg_dialog_arr. In this case,
$args
(listed as required) is definitely being passed in. I see that this method is suffixed with_arr
, not_args
, so that might be my confusion. The example, in this case, is clear that I need to assign new values to specific array members, and not create and return a new array.Also, note, in your revised documentation for wpmem_login_failed_args, you now have a “required” return value.
Return $args (array) (required) An array of arguments that are to override form $defaults.
Oh, and thanks for the tip on trac. Your plugin was not available in the list of plugins to attach to the ticket, so I wasn’t clear on how the association was even made, or if you’d get alerted.
Regards,
Josh
- This reply was modified 5 years, 11 months ago by Josh68.
One more way, seems to work:
add_action( 'pre_get_posts', array( $this, 'filter_posts_by_user_roles' ) );
/** * Filter posts by user roles * @param {object} $query */ function filter_posts_by_user_roles( $query ) { if ( is_admin() ) { return; } if ( $query->is_post_type_archive ) { $query->set('meta_query', array( array( 'key' => '_members_access_role', 'value' => wp_get_current_user()->roles, 'compare' => 'IN', ), )); } }
- This reply was modified 6 years ago by Josh68.
I’m not a seasoned WP dev. Looks like this will work at the template level:
$user_roles = wp_get_current_user()->roles;
Then, as part of my posts query (using Timber, in this case)
'meta_query' => array( array( 'key' => '_members_access_role', 'value' => $user_roles, 'compare' => 'IN', ), )
If there is a way to do this at a higher level in my application, or better way, in general, please advise.
Forum: Plugins
In reply to: [WP-Members Membership Plugin] wpmem_gettext returning default valuesBy “obvious,” I meant that the solution would have been obvious to me if I’d done more (any) custom WP work before. There’s a lot of fundamental WP API that I don’t know off the top of my head. Thanks
Forum: Plugins
In reply to: [WP-Members Membership Plugin] wpmem_gettext returning default valuesSorry, I’m not a seasoned WP dev (although, yeah, this is a very custom project), and if I were, I suppose that would have been obvious. Works perfectly, thanks.
Cheers,
Josh
Forum: Plugins
In reply to: [WP-Members Membership Plugin] Assign user role to new registarationExcellent. Thanks so much.
Forum: Plugins
In reply to: [WP-Members Membership Plugin] Assign user role to new registarationHello, Chad
I have a question based on this. I have been advised that our client will really want to have a set of custom user roles for members. I realize your plugin doesn’t manage custom roles, but we also looked at Members (a custom role solution) when we selected WP-Members as a membership solution.
I see I can add a registration field of my own choosing, and have gone ahead and added a Select I’ve called “Member Role,” to which I’ve assigned three name/value options. I’ve made this control required.
Is it wrong of me to think I could capture this value on registration, using the https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_register_data/ method, and then assign a desired custom role to that new member before the member profile is saved to the database?
Thanks in advance for any thoughts, and also for the excellent plugin.
Regards,
Josh Schneider
Thanks. I’ll have to determine whether that will mess up anything else for me. I’m beginning to think I should just get my client to purchase a private ssl cert, which I hope would avoid those problems.
Sorry if this is answered somewhere else, or if I’m just being a numbskull, but should it be possible with the Shared SSL setting enabled to redirect a single page within your site? I know that I have my base URL set to my non-secure, paid domain name in several places (eg, in WP settings and elsewhere in the DB), and therefore I don’t want to simply change all of my settings to my host’s secure URL, but I can only navigate to my site’s homepage and wp-admin using the https URL – none of the subpages work (I get 404s). The plugin does seem to work properly, though, by just redirecting at the page level.
Be nice if the developers of the plugin changed the meaning of the color red (=”bad”) or added another color, like purple (=”probably not a problem”) to their compatibility check key. Thanks for the info.
Sorry, I think I answered my own question. I couldn’t see the tips for WP-SMTP-MAIL once I put all settings in a config file, but now I’m seeing them again as comments in the plugin code: “You can specify the email address that emails should be sent from. If you leave this blank, the admin email will be used,” and “You can specify the name that emails should be sent from. If you leave this blank, the emails will be sent from WordPress.” I guess there’s no other way to set it (like undefined), and in this case, the Fast Secure Contact Form won’t override those settings, and even though it populates the “Reply-To” field correctly, hitting reply automatically directs to what’s in the “From” field, which is the site owner/admin.
Thanks. While my form seems to work without the “Email From” field filled in, it seems the “From” field is actually set to what’s in the “Email To” field, which is my own or my client’s email. Since the email address of the form submitter appears in the email generated, and is a clickable link, that’s not a big hassle, but I wonder if there’s something I might be doing wrong if the sender’s email address isn’t the “From” address in the generated email and I have the “Email From” field left blank (the “Reply To” address is correctly set as the form submitter’s email). BTW, I’m using WP-SMTP-MAIL, and have those environment variables set up in a config file. I’ve removed the “From” configuration settings (set them to empty strings) and it’s the same behavior.
Thanks. So, to clarify, if that field is left blank (and if that’s okay with my host), the return path should be the sender’s address? But you’re also saying it might be better to forgo convenience and use the Email From field, set to a real domain-specific address (like [email protected]), and then use information included in the email message body to get the correct reply-to address?
So I’m not done testing my installation (thanks for the great plugin, BTW), and I had the same question. I’ll have to change options to see what’s happening if I don’t hear something from my client (who owns the domain), but does this mean that leaving “Email From (optional)” blank, if it works at all, should send the email to me (or my client) with the Reply-To field containing the submitter’s address, and if I put a domain-specific email in the “Email From (optional)” field, will the form send an email with that domain-specific email in the Reply-To field? This isn’t as well documented in the help tip as most things are in your application, which is really well documented. Thanks.
Forum: Plugins
In reply to: [Plugin: WP Mail SMTP] SMTP test e-mail not working with GmailOh, and test message reports success. No error.