tharsheblows (@tharsheblows)

Forum Replies Created

Viewing 25 replies - 51 through 75 (of 84 total)
  • In reply to: Theme problem

    tharsheblows
    Participant

    @tharsheblows

    I looked at this when you first posted and you were working on it so I came back to it before I went to bed and it was all working correctly – now it’s not, of course.

    There is something that is causing your css and js directory paths to be incorrect. Your files are there but it’s getting confused about where “there” is.

    I know it’s frustrating (I’d be frustrated at any rate) but maybe go back and disable all plugins and then make sure you’ve cleared your browser’s cache completely using eg Chrome->Tools->Clear browsing data to test.


    tharsheblows
    Participant

    @tharsheblows

    Editing the template files is fine – that’s one of the big draws of open source to me.

    If you add this to your current theme’s functions.php file, you should get login forms for non-logged in users in the appropriate places. NB: never ever edit your functions.php file through the WordPress admin area – you need to have ftp access or your access to your hosting control panel (ie independent of WordPress) so you can undo whatever you’ve just done in case it all goes wrong.

    I can try to explain where the functions.php file is but I do tend to make people more confused sometimes so won’t unless you ask!

    //this adds the login form on a single topic so someone can leave a reply. It uses the same logic as form-reply
    function mjj_new_reply_login(){
    	if( !bbp_current_user_can_access_create_reply_form() && !bbp_is_topic_closed() && !bbp_is_forum_closed( bbp_get_topic_forum_id() ) ){
    		bbp_get_template_part('form', 'user-login');
    	}
    }
    
    add_action('bbp_template_after_single_topic', 'mjj_new_reply_login');
    
    //this adds the login form on a single forum so someone can start a topic. It uses the same logic as form-topic
    function mjj_new_topic_login(){
    	if( !bbp_current_user_can_access_create_topic_form() && !bbp_is_forum_closed() ){
    		bbp_get_template_part('form', 'user-login');
    	}
    }
    
    add_action('bbp_template_after_single_forum', 'mjj_new_topic_login');

    tharsheblows
    Participant

    @tharsheblows

    Thanks so much for taking the time to post all of that! πŸ™‚

    What plugins are you using? I’m asking because I don’t have this for admins / moderators:

    On the visual tab, logged in, in addition to the standards there is undo, redo, add link, remove link and insert/edit image. Perfect, exactly what I wanted for the moderators.

    I did some fire-fighting for a site where the textarea input text was white, which I think was happening with your moderator here –

    But then when you were typing in the message window, the text was not visible?
    Right, NOT visible.

    Anyway, I added a style and !important (cringe but y’know, needs must) to it to force it to be black.

    Thanks again – feel free to ignore for a while if you’d rather think of something else over the holiday! Sorry for the constant questions – for some reason I’m really curious about this and finding it all rather fascinating.


    tharsheblows
    Participant

    @tharsheblows

    You’re using float:right at the moment? I think I’d use something like display:block; text-align:right; or something like that.


    tharsheblows
    Participant

    @tharsheblows

    I’m not quite clear on your code, so can’t help with the last piece.

    As I mentioned, I did it differently and specific to the forum I was working on which has categories with forums but no sub-forums and one single forum without a category. I don’t think this will help you unless you decide to try something different but this is what I did – in loop-forums.php replace the while loop with :

    <?php while ( bbp_forums() ) : bbp_the_forum(); ?>
       <?php if( !bbp_is_forum_category() ) {
         bbp_get_template_part( 'loop', 'single-forum' ); 
       } else {
         bbp_get_template_part( 'loop', 'single-categories' ); 
       } ?>
    <?php endwhile; ?>

    and then I made a loop-single-categories.php https://bbpress.trac.wordpress.org/attachment/ticket/1958/loop-single-categories.php


    tharsheblows
    Participant

    @tharsheblows

    Yep – use get_post_time() – https://codex.wordpress.org/Template_Tags/get_post_time

    function mjj_post_reply_date(){
      printf('<div class="mjj-post-date">');
      $reply_id = bbp_get_reply_id( $reply_id );
      printf( get_post_time( get_option( 'date_format' ), false, $reply_id, true ) ); 
      printf('</div>');
    }
    
    add_action ('bbp_theme_before_reply_content', 'mjj_post_reply_date') ;

    tharsheblows
    Participant

    @tharsheblows

    @Matoca it sounds like you’re still using tinyMCE? Do you have something like this in your functions file –

    function bbp_enable_visual_editor( $args = array() ) {
        $args['tinymce'] = true;
        return $args;
    }
    add_filter( 'bbp_after_get_the_content_parse_args', 'bbp_enable_visual_editor' );

    (from https://codex.bbpress.org/enable-visual-editor/ )

    I might be confused (if we had signatures and I used signatures on forums mine would be “I might be confused”) but I wouldn’t think you’d have a text / visual tab on the non-tinyMCE editor, would you?

    If it were me, I’d also try disabling “Post Formatting” in Settings -> Forums in the admin area. I have no clue whatsoever if that would work though, it’s just something I’d try.

    I’m really interested to see what works! My guess is that something will end up working but we’ll never quite know what did it.


    tharsheblows
    Participant

    @tharsheblows

    You can use bbp_reply_post_date for it – it will give you “August 4, 2012 at 2:37 pm”. I mean, it would give you that for posts on Aug 4, 2012 at 2.37pm and similar things for other dates.

    But you want to style it a bit, so something like:

    function mjj_post_reply_date(){
      printf('<div class="mjj-post-date">');
      bbp_reply_post_date(); 
      printf('</div>');
    }
    
    add_action ('bbp_theme_before_reply_content', 'mjj_post_reply_date') ;

    tharsheblows
    Participant

    @tharsheblows

    I thought it did – are you using the default bbpress template? There is every chance I’m confused.


    tharsheblows
    Participant

    @tharsheblows

    Are you using a custom bbpress template in your theme? You will need to edit some files in there if so. I don’t think there’s another way, although you might look to see if there’s a plugin that does it.


    tharsheblows
    Participant

    @tharsheblows

    Hi – I think this is being / was discussed on trac a while ago. I have a solution I use there but it is specific to my needs and is one of those pieced-together-on-the-fly things. You might find Bob1nz’s files in the last post on the thread more helpful.

    Sorry if I’ve completely misunderstood, but hope that helps some.


    tharsheblows
    Participant

    @tharsheblows

    Oh good – I have this in a header – it’s about the same but $user_identity is the display name rather than the login. This explains the different global variables from get_currentuserinfo() – https://codex.wordpress.org/Function_Reference/get_currentuserinfo . Just in case you want the full reference – I hadn’t really looked at it before and noticed we used different variables and wondered why and thought you might be interested too. πŸ™‚

    <?php if ( is_user_logged_in() ) { ?>
      <span class="break-me">
      Welcome, 
      <?php 
    	global $user_identity;
    	get_currentuserinfo();
    	printf('%s', $user_identity); ?>! 
      </span>
      <span class="break-me">
    	<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Log out?</a> &bull; <a href="<?php echo bbp_get_user_profile_url(get_current_user_id()); ?>" name="Your profile and posts">Your profile</a> 
      </span>
    <?php } ?>

    tharsheblows
    Participant

    @tharsheblows

    There’s probably a plugin for it but I would cheat and make an email address that forwarded to all of the email addresses I wanted. I’ve had a couple of email customisation plugins fail over various updates, so I don’t have any to recommend!

    Otherwise, the new user notification emails are pluggable functions which means that you need to override them in a plugin. The function in question starts at line 1569 here: https://github.com/WordPress/WordPress/blob/master/wp-includes/pluggable.php

    Don’t edit that code – it will get overwritten in a future update – that’s just the function that you would use to make your own plugin (or what any plugin that does it will use).


    tharsheblows
    Participant

    @tharsheblows

    Yay! Alright, glad it worked. πŸ™‚


    tharsheblows
    Participant

    @tharsheblows

    Sure – this is what I did on a test install. The current menu item class in mine is “current-menu-item” and I added a custom class “forum-class” to the forum menu item in my custom menu. I *always* forget that I need to unhide the css class input by ticking the box in “Screen options” at the top of the “edit menus” screen in admin. You probably don’t but I thought I’d mention. πŸ™‚ Then I use that for the jQuery.

    So:

    1 – add “forum-class” to your forums menu item in your custom menu
    2 – add this to your js file with YOURURL = the url of your site and forums = your forums slug :

    $(function() { 
    	      var forumURL = window.location.href.indexOf("YOURURL/forums/");
    	      if(forumURL > -1){
    	      	$('li.forum-class').addClass('current-menu-item');
    	      }
    	}); 

    nb: addClass won’t add duplicate classes so no need to test if it’s already there.


    tharsheblows
    Participant

    @tharsheblows

    Adding for completeness: I have bbpress-functions.php and bbpress.php in the main theme directory, not in the bbpress subdirectory.


    tharsheblows
    Participant

    @tharsheblows

    You can take out <?php bbp_forum_subscription_link(); ?> in content-single-forum.php . I have a bbpress directory in my theme (eg mytheme/bbpress/) where I’ve copied the entire default template and those files overwrite the default theme which I got from templates/default/bbpress in the plugin.

    So you’d have something like yourtheme/bbpress/content-single-forum.php. I’m looking at this https://codex.bbpress.org/theme-compatibility/step-by-step-guide-to-creating-a-custom-bbpress-theme/ and getting confused but I have a feeling you’ll work it out! Anyway, that’s where that code is.


    tharsheblows
    Participant

    @tharsheblows

    For the topics archive showing all topics, you can use the shortcode [bbp-topic-index] on a normal WordPress page.

    “All replies” is slightly different. You could use the Recent Replies widget (https://codex.bbpress.org/widgets/) if you had a page with a widget for the content but if you wanted a proper archive page, I think you’d have to make a new template for it. I think it’s one of those things that if enough people ask for it, it might get prioritised for future versions but that’s just a guess. If you are comfortable making page templates, I can post how I did a “latest posts” page (posts = new topics + replies).

    I’m not sure what part of the menu you mean, I’m sorry. Do you mean how “support” (with a link to /forums) is highlighted above even when you’re on a topic page? They use a custom nav file:
    https://meta.trac.wordpress.org/browser/sites/trunk/buddypress.org/public_html/wp-content/themes/bb-base/header-nav.php

    If I were trying to replicate that, I would use jQuery to add the current-menu-item class to the top forums list item – not that it’s is the right way to do it, it would just be the easiest for me to do and to maintain. You’d need to add it to a javascript file in your template or make one and then include it. If you’re interested, I can post that code – you will need to add a custom class to your forums menu item too.

    Sorry, I know that wasn’t too terribly helpful!


    tharsheblows
    Participant

    @tharsheblows

    I had a problem with a user who couldn’t post from her iPad – it was an issue with tinyMCE and I ended up disabling it. Also, someone who used tinyMCE on a different platform had problems as well – he read about her problem on our forum and emailed me with the same issue.

    Here was her initial report – I am not sure if it’s the same problem your user is having:

    there’s something very odd going on with the cursor control when I try to input text using a stylus and the onscreen keyboard of my iPad2. If I touch the screen to move the cursor way from the latest word typed, perhaps to edit a phrase or correct a typing error, then the whole thing seems to freeze. To release it, I have to touch the key that moves the keyboard offscreen and then touch the screen again to place the cursor wherever I need to amend the text – the keyboard reappears, I type in the amendment and then the cursor is fixed at that point again. Every time I want to move around the text in any way, I have to repeat the keyboard-disappearance-and-touch-the-screen-to-place-the-cursor trick.

    It wasn’t a problem across all iOS devices – I never did figure out exactly what combination of things on hers was causing it and I was going to disable tinyMCE anyway, so didn’t try all that hard to figure it out.

    I don’t know what version of tinyMCE WP uses – I see that WP 3.9 is using tinyMCE 4 but not sure if it’s going to be 4.0.11:
    http://stackoverflow.com/questions/18629341/cannot-type-into-empty-tinymce-4-area-on-ipad


    tharsheblows
    Participant

    @tharsheblows

    I think this is going to be less than helpful for you, I’m sorry.

    I’m not sure but it doesn’t look like / I can’t find where bbp_notify_forum_subscribers (the function that sends emails to subscribers) is hooked into the admin topic post save. What I mean is, you’re right, the subscriptions don’t seem to sent if you create a new topic in admin. (I could be completely wrong about this and just missed something though.)

    Anyway, I’m just going to write down where I would start if that is the case because I hope that I can come back to this in a bit or someone else will and otherwise I’ll forget (I’m off on holiday tomorrow). I would say to hook it into save_post but I’m not sure that you can do that because bbp_notify_forum_subscribers doesn’t check post type so would run on any post type save.

    So something like this: https://codex.wordpress.org/Plugin_API/Action_Reference/save_post#Custom_Post_Type:_.27book.27 I mean the write a function that checks for post type bit and call bbp_notify_forum_subscribers.

    And do the same thing with the reply post type, too (but with bbp_notify_subscribers).

    If this gets moved to trac, it would be easier to change those two functions to check for post type first thing and hook them both directly into save_post rather than the way above.

    Again, I might just be missing where it’s hooked in. I hope that I’m missing something obvious and it’s an easy fix! πŸ™‚


    tharsheblows
    Participant

    @tharsheblows

    Cool, thanks. It will take me a while to get to it, but I will!


    tharsheblows
    Participant

    @tharsheblows

    I think it’s the ajax call that’s doing it. So you would need to filter the bbp_get_user_subscribe_likelink like this – this also includes the bits to change your subscribe and unsubscribe links:

    function hide_before2 ($args = array() ) {
    $args['before'] = '&nbsp';
    $args['subscribe'] = 'Click to receive an email notification when a member responds below';  
    $args['unsubscribe'] = 'Unsubscribe'; // or whatever
     
     return $args;
    } 
    
    add_filter('bbp_before_get_user_subscribe_link_parse_args', 'hide_before2');

    tharsheblows
    Participant

    @tharsheblows

    Sorry I just realised I didn’t answer your question. Yes – a link like this:

    …/topic-unsubscribe?user=2&topic=5586&cs=5E82028F8F1866AF401D5C7C7FC16331

    where cs is a md5 hash which involves user id, topic id and a salt. I am not going to use a WP nonce because I don’t want the link to ever expire as that’s frustrating for users and I don’t know a way to change the lifespan of a single nonce. This does mean that if they forward the email to someone, that person can unsubscribe them but I think that will be ok. The most important thing for me is that all one-click signups on my site have one-click unsubscribes.

    This is just in my head at the moment, I haven’t done it yet, so the actual implementation will probably change.


    tharsheblows
    Participant

    @tharsheblows

    I definitely need to sit down and learn how to submit a patch on Trac. This is in my list of things to do.

    I have a system* for keeping track of core changes on plugins – I’m pretty used to doing upgrades then adding back in my own changes.

    *it involves notes to myself in shouty capital letters and exclamation points in the plugin description. It is not the greatest system.


    tharsheblows
    Participant

    @tharsheblows

    What will it bottleneck? What’s going to not happen quickly? That’s the part I’m unsure about. I can’t see anything but thought I’d ask! The send can go slowly, that’s fine – I just want the page to load quickly after they post and figured if that happened before sending all the emails, people wouldn’t notice or care about the slow emails; those don’t have to be instantaneous.

    I am writing something to add a one-click unsubscribe link for the subscription emails, so need them to be unique for each recipient in that respect.

Viewing 25 replies - 51 through 75 (of 84 total)