Forum Replies Created

Viewing 15 replies - 1 through 15 (of 30 total)
  • Thread Starter kostek00

    (@kostek00)

    It is a shame that plugin doesn’t work correctly. I saw options in it that are exactly what I wanted.

    Forum: Hacks
    In reply to: Hide certain tags from users
    Thread Starter kostek00

    (@kostek00)

    Oh, I didn’t even considered that way. Thanks a lot.

    • Tags without last pipe – done.
    • Hiding tags for users – done.

    If anyone else would like to use it here it is.

    Code for hiding tags:

    function exclude_tags($tags) {
    		if ( current_user_can('activate_plugins'))
    		return $tags;
    		
    		foreach ($tags as $tag)
    		switch ($tag->name) {
    		case 'tag1':
    		case 'tag2':
    		case 'tag3':
    		break;
    		default:
    		$newtags[] = $tag;
    	}
    	return $newtags;
    }
    add_filter( 'get_the_tags', 'exclude_tags');

    Code for showing tags on pages that works with function above:

    <?php $tags = get_the_tags();
    if( $tags ) :
    	echo '<p class="taxonomy"><span class="tag-title">'.__('Tags: ', 'warp').'</span>';
    	foreach( $tags as $tag ) {
    		$names[] = '<span class="'. $tag->slug .'"><a href="'. get_tag_link($tag->term_id) .'">'. $tag->name .'</a></span>';
    	}
    echo implode(' | ', $names ) . '</p>';
    endif; ?>

    Also this code creates for each tag classes with name of tag slug.

    • This reply was modified 8 years, 2 months ago by kostek00.
    Forum: Hacks
    In reply to: Hide certain tags from users
    Thread Starter kostek00

    (@kostek00)

    I still can’t make implode() work. When I try to implement it it does show tags without separator at end but they are not as links. Whats more it shows first set of tags without separator but as links and then those not linked. Like so: tag tag tagtag | tag | tag

    For now I changed code to only one bigger block of PHP instead of many small.

    <?php $tags = get_the_tags();
    if( $tags ) :
    echo '<p class="taxonomy"><span class="tag-title">'.__('Tags: ', 'warp').'</span>';
    foreach( $tags as $tag ) {
    echo '<span class="'. $tag->slug .'"><a href="'. get_tag_link($tag->term_id) .'">'. $tag->name .'</a></span>';
    }
    echo '</p>';
    endif; ?>

    If i won’t be able to make it work I will look into CSS :last-child with adding pipe after </span>.

    • This reply was modified 8 years, 2 months ago by kostek00.
    Forum: Hacks
    In reply to: Hide certain tags from users
    Thread Starter kostek00

    (@kostek00)

    I used capability instead of role in excluding function as you suggested and now it works exacly like I wanted it. Big thanks to you. I always thought that roles and capabilities are readed the same, I guess I was wrong.

    I also made “Tags: ” translatable with code below. The best thing is that I don’t need to change .po and .mo files as it will be in the same line as original code.

    <?php $tags = get_the_tags();
    if( $tags ) : ?>
    <p class="taxonomy">
    <?php echo '<span class="tag-title">'.__('Tags: ', 'warp').'</span>' ?>
    <?php foreach( $tags as $tag ) { ?>
    <span class="<?php echo $tag->slug; ?>"><a href="<?php echo get_tag_link($tag->term_id); ?>"><?php echo $tag->name; ?></a></span>
    <?php } ?>
    </p>
    <?php endif; ?>

    Now my problem is that I can’t make last pipe to be hidden. I tried to use implode() as you suggested but my best result looked like that:
    Tags: tag | | tag | | tag | | and so on

    Forum: Hacks
    In reply to: Hide certain tags from users
    Thread Starter kostek00

    (@kostek00)

    I thikn you misunderstand second part (or did I misunderstand your response?).

    <?php the_tags('<p class="taxonomy">'.__('<span class="tag-title">Tags: </span>', 'warp'), ' | ', '</p>'); ?>
    Code above is my theme default code and with him function to exclude tags don’t work.

    I need to somehow format code below (from link in my previous post):

    <?php $tags = get_the_tags();
    if( $tags ) : ?>
      <p class="tags">
      <?php foreach( $tags as $tag ) { ?>
       <span class="<?php echo $tag->slug; ?>"><a href="<?php echo get_tag_link($tag->term_id); ?>"><?php echo $tag->name; ?></a></span>
      <?php } ?>
    </p>
    <?php endif; ?>

    To make tags looks like:
    Tags: Tag1 | Tag2 | Tag3 | Tag4
    As currently this code shows tags without any seprator and I can’t seem to make “Tags: ” word translatable.

    Forum: Hacks
    In reply to: Hide certain tags from users
    Thread Starter kostek00

    (@kostek00)

    So I was poking here and there and I found something helpful. Here I found another method to show tags on page with class creation of tag name which leads me to 2 things.

    1. If it’s possible to load css file in plugin based on user capabilities then I can create that file which will hide those tags. I don’t prefer this method because I will need to somehow hide separators from between tags.

    2. I also found this function that actually works with this method of showing tags:

    function exclude_tags($tags) {
    		foreach ($tags as $tag)
    		switch ($tag->name) {
    		case 'tag1':
    		case 'tag2':
    		break;
    		default:
    		$newtags[] = $tag;
    	}
    	return $newtags;
    }
    add_filter( 'get_the_tags', 'exclude_tags');

    The thing is if I add capabilities check to this then it hides those 2 tags to admins and hides all tags to all other users. While it should only hide those 2 tags to other user and nothing else. Admin should see all tags all the time.

    function exclude_tags($tags) {
    	if ( !is_super_admin() )
    		return;
    
    		foreach ($tags as $tag)
    		switch ($tag->name) {
    		case 'tag1':
    		case 'tag2':
    		break;
    		default:
    		$newtags[] = $tag;
    	}
    	return $newtags;
    }
    add_filter( 'get_the_tags', 'exclude_tags');

    There is one more thing. If I would use method above to show tags on pages then it requires some sort of formating to make tags showed like this code:
    <?php the_tags('<p class="taxonomy">'.__('<span class="tag-title">Tags: </span>', 'warp'), ' | ', '</p>'); ?>
    It’s look:
    Tags: Tag1 | Tag2 | Tag3 | Tag4
    (Word “Tags: ” is translatable)

    Forum: Hacks
    In reply to: Hide certain tags from users
    Thread Starter kostek00

    (@kostek00)

    I wanted to hide tags on pages as I don’t tag posts and tag cloud I modified to show only selected tags. By default my theme don’t show tags on pages, luckly I found in posts line that does that and copied it to pages. Theme uses the_tags() method to display tags on pages.

    I also want to mention that I only know HTML and CSS. All my tries were dependant on online guides and possibility that it maybe somehow will work.

    Forum: Plugins
    In reply to: [BAN Users] UTF-8 support
    Thread Starter kostek00

    (@kostek00)

    By the way what for is “BANed” column in user overview? What informations it shows?

    Forum: Plugins
    In reply to: [BAN Users] UTF-8 support
    Thread Starter kostek00

    (@kostek00)

    Thanks for quick fix, everything works perfectly fine.

    Forum: Plugins
    In reply to: [BAN Users] UTF-8 support
    Thread Starter kostek00

    (@kostek00)

    I have other plugin that modifies default wordpress mails and it sends them perfectly fine.

    Thread Starter kostek00

    (@kostek00)

    Apparently I downloaded your plugin right before version 1.2.4 was avaible, lucky me. Errors aren’t showing now.

    And to answer to your question here are 2 things that I feel like they are missing:
    1. Can’t write email template in HTML, only plain text avaible. I have on my site plugin Better Notifications for WordPress that allows me create custom templates for wordpress messages so it would be nice if I could apply them to your plugin as well. And I don’t mean to apply them via Better Notifications for WordPress but directly in your plugin.
    2. More detailed time ban. For example I would like to ban someone to 30.08.2016 16:00, or for specified time like 4 hours.

    Thread Starter kostek00

    (@kostek00)

    I do understand that and I know I will probably use it sooner or later as it is useful. I don’t want this to be gotten rid of not at all. All I’m asking is if it could be possible to make another state that won’t disable that type of mails and it won’t require removing this notification or disable plugin.

    Thread Starter kostek00

    (@kostek00)

    I understnad.

    I have a proposition. Could you make it possible to save notifications also as drafts so that they won’t interfere with normal wordpress behaviour when it’s not intended? You know just like with posts and all. It’s created, it exists but not affects anything.

    Or maybe some sort of checkbox that will disable that notification but won’t disable that type of mails.

    Thread Starter kostek00

    (@kostek00)

    Yes. When I create notification and disable it wordpress isn’t sending even the default one.

    Thread Starter kostek00

    (@kostek00)

    That is correct.

Viewing 15 replies - 1 through 15 (of 30 total)