Skip to:
Content
Pages
Categories
Search
Top
Bottom

default cover photo problems


  • karmatiger
    Participant

    @karmatiger

    I’m trying to set a default cover photo for new users who haven’t yet set one. I’m using:

    function bp_custom_filter_cover_image() {
        return 'http://www.sanguinenation.com/wp-content/uploads/2016/09/under-construction.jpg';
    }
    add_filter( 'bp_attachments_pre_get_attachment', 'bp_custom_filter_cover_image' );

    …but this doesn’t just set a cover photo for new users, it overwrites the cover photo for existing users. How can I add an if that’ll check if there’s already a custom cover photo, and if so not set the default one?

Viewing 6 replies - 1 through 6 (of 6 total)

  • karmatiger
    Participant

    @karmatiger

    forgot to check notify me of replies


    danbp
    Participant

    @danbp

    Hi !
    Try this plugin, it does exactly what you need. In BP options, leave Replace BP 2.4 functionality unchecked and you’re done.
    https://wordpress.org/plugins/buddypress-cover-photo/


    karmatiger
    Participant

    @karmatiger

    isn’t fixing a snippet of code easier? all I need is to check whether or not there’s already a cover photo already attached to that profile.

    Every time there’s a problem with the theme as it is, seventhqueen says “add this 3rd party plugin”. I now have 33 plugins already running, which isn’t doing any wonders for performance, or a tidy backend, and throwing more plugins at things will only exacerbate the problem.


    danbp
    Participant

    @danbp

    Easier ? May be if you’re comfortable with coding custom functions !
    Problems ? Which ones ? Why would you have less(or more) problems with a custom snippet as with a plugin ?

    To check the existence of a cover image, see bp_attachments_get_user_has_cover_image( $user_id )
    Is defined in bp-core/bp-core-attachments.php:1064


    mllapan
    Participant

    @mllapan

    @danbp you’re boring with that plugin in every single topic about default cover image.

    I am looking to set default cover image too, but without overriding the existing ones.

    That plugin SUCKS!


    mllapan
    Participant

    @mllapan

          <?php // Get the Cover Image
            $member_cover_image_url = bp_attachments_get_attachment('url', array(
              'object_dir' => 'members',
              'item_id' => bp_loggedin_user_id(),
            ));
          ?>
    <img src="<?php echo $member_cover_image_url; ?>">

    Try this with that plugin and it won’t work at all.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.
Skip to toolbar