Forum Replies Created
-
AuthorPosts
-
quick_dry
Participantthey mean that the users ARE able to reset their password via the “Edit Profile” page, but if they use the “forgot password” feature, where the site resets your password to a random password and sends you the password in an email – the emailed password does not work when they try to login.
(I’m on a previous release so I couldn’t do a test of 3.9.7)
quick_dry
Participanttested the COUNT() approach and submitted the pull request to the wp-insider repo on github (https://github.com/wp-insider/simple-membership )
If you can update the forum title to “Member Admin exceeds available memory, gives 404” that might make it clearer to other members who have this issue and need to patch their swpm_members class before a fix makes it to the plugin updates.
quick_dry
ParticipantOK, I found the problem.
The class.swpm_members.php needs to be more memory friendly – it is fine for small numbers, but not when you have many members and many categories.
Problem: class.swpm_members.php prepare_items() exhausts available memory. It brings back every record in the join of swpm_members_tbl and swpm_membership_tbl. All the ‘list’ fields blow it out significantly bringing back about 49 fields per member when only 9 are used (member_id, user_name, first_name, last_name, email, alias, subscription_starts, account_state, last_accessed). I’m not a PHP guy but (if I’m not mistaken) it only does the first query returning everything in order to do an initial record count, after that it requeries the DB with record number limits. But by the time you do that, the memory has already blown out.
Changing the class.swpm_members.php->prepare_items() to name the 9 columns instead of using “*” immediately fixes the problem at _this_ number of members. But I think the proper fix is to do the first query with something like COUNT(member_id) and then do the second query with pagination limits as is (I think this would also be better done with named columns to limit the data being shuffled around, but open to correction by someone who knows MySQL better than me)
Doing it with COUNT then pages should make it handle massive member counts without needing massive memory.
Is there a github repository to submit issue and pull requests to? (I submitted a pull request addressing the cron job for expired accounts to https://github.com/wp-insider/simple-membership but I don’t know if it has been looked at, or if that is the wrong place to submit to?)
quick_dry
ParticipantFurther inpsection, is it possible this is caused by running out of memory? Though that raises the obvious “how does generating a page with only 50 member details on it, use over 2GB of memory?”
Does SWPM load every member into memory when it generates the membership admin screen – and if so, where should I be looking to quickly patch this so that it doesn’t?
quick_dry
Participantthat was how I narrowed it down to the “Simple Membership After Login Redirection” plugin having the effect.
Activate – no swpm_after_login.
Deactivate – swpm_after_login works _and_ lines of code immediately after the do_action call in the main swpm plugin.
quick_dry
Participantfilter for wp_mail when it tries to send, then nuke the email details if it meets your criteria
add_filter(‘wp_mail’,’disabling_swpm_emails’, 10,1); function disabling_swpm_emails( $args ){ if ($args['subject']=='foo'){ $args['to']=''; $args['message']=''; } return $args; }quick_dry
ParticipantI know this is an old thread, but I had the same problem. Not sure if there is a better version yet, but I did it with a filter on wp_mail looking for any email with a certain phrase in the subject (that i could set via the SWPM admin screen) and removing the ‘to’ and ‘message’.
add_filter(‘wp_mail’,’disabling_swpm_emails’, 10,1);
function disabling_swpm_emails( $args ){
try {
if (strpos($args[‘subject’],’DO_NOT_SEND_THIS_EMAIL’)>-1){
$args[‘to’]=”;
$args[‘message’]=”;
}
} catch (Exception $e) {
//do nothing
}
return $args;
}quick_dry
Participantyou probably already solved it, but this might help someone else – rather than customising the plugin and losing changes on update. Put it in a little site specific plugin, and modify the shortcode’s output. e.g. I use the mod_swpm_login_form shortcode, instead of swpm_login_form
//Replace the [swpm_login_form] shortcode output with something else
function shortcode_mod_swpm_login_form(){$output=do_shortcode(‘[swpm_login_form]’); //Get the standard shortcode’s output
//do stuff with the strings here, replace this, remove that, etc
return $output;
}
add_shortcode(‘mod_swpm_login_form’, ‘shortcode_mod_swpm_login_form’);`quick_dry
Participant@Mickael instead of messing with your theme, you could put it in a plugin specific to your site – just follow a “build a simple plugin” and put something like this in it – you can see how it checks and modifies the swpm_login_form shortcode’s output. Just call it with the ‘mod_swpm_login_form’ shortcode instead of swpm_login_form.
//Replace the [swpm_login_form] shortcode output with something else //e.g. remove the username from the form output when logged in function shortcode_mod_swpm_login_form(){$output=do_shortcode(‘[swpm_login_form]’);
if (strpos($output,’Logged in as’)>-1){ //if user is logged in
$output=str_replace(‘>Logged in as</div>’,’>Logged in</div>’,$output);
$output=preg_replace(‘/\<div class=\”swpm-logged-username-value swpm-logged-value\”\>(\S+)\<\/div\>/U’, ”, $output);
}
return $output;
}
add_shortcode(‘mod_swpm_login_form’, ‘shortcode_mod_swpm_login_form’);`quick_dry
Participantis there any resolution to working with miniorange social login? (or any providers other than accesspress?) super socialiser doesn’t work either, they create the members – but SMP never recognises the users as logging in – though other plugins do.
-
AuthorPosts