Support » Plugin: Simple Local Avatars » Issues when used on the frontend (bbpress specifically)

  • m4olivei



    Awesome plugin, you rock!

    I did find a couple issues though using your plugin with bbPress, which exposes a front end profile form by triggering the show_user_profile or edit_user_profile actions. There are a couple other plugins that do this (theme my login?).

    First issue is detailed here: The jist of which is a bunch of PHP warnings are thrown b/c a there is an argument missing in the call to Simple_Local_Avatars::get_avatar()

    Next issue is with deleting an avatar. When you click Delete local avatar, it doesn’t do anything. The reason for this is that your code to do the deletion happens on the action admin_action_remove-simple-local-avatar. This action will only fire when on in the WordPress dashboard, not on the front end. To fix it I did this:

     * Handle the action for removing simple local avatar
    add_action('template_redirect', 'do_action');
    function do_action() {
      global $simple_local_avatars;
      if (!$simple_local_avatars) {
      if (empty($_REQUEST['action'])) {
      else {
        $action = $_REQUEST['action'];
      switch ($action) {
        case 'remove-simple-local-avatar':
          if (!is_admin()) {

    Then in order for that to work, I had to set the remove_nonce as it was being set in a place that was exclusive to the WordPress Dashboard. So in simple-local-avatars.php in the edit_user_profile() function, i added:

    public function edit_user_profile( $profileuser ) {
      if (!isset($this->remove_nonce)) {
        $this->remove_nonce = wp_create_nonce('remove_simple_local_avatar_nonce');
      // ... rest of code

    That made it work. Again great plugin, just could use some improvement to make it more useful across plugins that put profile pages on the front end too.


Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi, I’m trying to replicate this but can’t seem to get it to work.

    Where have you put the first piece of code with the action hook? Wherever in simple-local-avatars.php I put it it says that do_action() is already declared in another file. And I have no luck with changing the name of the function either.

    Thank you


    I put it in a custom plugin, should also work within functions.php in a theme. Change the name of the function to something other than do_action and update the call to add_action() accordingly. Sorry about that. In my plugin I have the function as a method of a class so I didn’t run into that naming collision.


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Issues when used on the frontend (bbpress specifically)’ is closed to new replies.