If you have no galleries added, the output of the media gallery module is a text and a link to add a new gallery.
It would be nice to see no link, if the current user do not have access to it.

File: media_gallery.pages.inc
Line: 66-70

    $build['no_content'] = array(
      '#prefix' => '<p>',
      '#markup' => t('No galleries have been set up yet. <a href="@link">Add a gallery.</a>', array('@link' => url('node/add/media-gallery'))),
      '#suffix' => '</p>',
    );

A possible solution may be the following replacement code:

    $no_content_text_arg = array();
    $no_content_text = 'No galleries have been set up yet.';
    if( node_access('create', 'media-gallery') ) {
      $no_content_text .= ' <a href="@link">Add a gallery.</a>';
      $no_content_text_arg['@link'] = url('node/add/media-gallery');
    }
    $build['no_content'] = array(
      '#prefix' => '<p>',
      '#markup' => t($no_content_text, $no_content_text_arg),
      '#suffix' => '</p>',
    );
CommentFileSizeAuthor
#2 hide-add-gallery-link-1234068-2.patch755 bytesmoloc

Comments

awasson’s picture

Subscribing... I have the exact same need.

I think it would be helpful to be able to customize the message with the option to include a link to create a gallery depending on the need of the end user.

Other than that, I sure do like this module!

moloc’s picture

Title: remove add gallery link, when the user has no permission » hide the 'add gallery' link, if the user has no permission
Status: Active » Needs review
StatusFileSize
new755 bytes

This patch removes the Add a gallery link, if the current user has no permission to create a gallery.

lsolesen’s picture

awasson. could you review

lsolesen’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.