Search Results for 'code'
-
AuthorSearch Results
-
March 2, 2015 at 5:20 pm #159157
In reply to: forum martinique
March 2, 2015 at 12:24 pm #159141In reply to: sidebar widget "forum List" not showing up
Marion Peterson
ParticipantUnfortunately, deactivating all plugins did not help. I did not test a default theme.
If I create a child theme and install the bbpress codes, will I still potentially have a problems with this, or will this no longer be an issue then?
March 2, 2015 at 2:13 am #159132In reply to: Remove Forum Boxes – See Inside for Screenshot
Robkk
Moderatori dont know what could have caused that
you can also hide it with CSS
.bbp-forum-description, .bbp-topic-description { display:none; }March 2, 2015 at 1:25 am #159131In reply to: Remove Forum Boxes – See Inside for Screenshot
Alice Kaye
ParticipantHey @Robkk,
That code worked well, with one exception, now the top bar with Topic, Post, Freshness, etc. those have become links, oddly.
Example: http://screencast.com/t/uDncP5v4
Any idea?
I used your code:
/* Forum Description Removal Begin */ add_filter( 'bbp_get_single_forum_description', 'ja_return_blank' ); add_filter( 'bbp_get_single_topic_description', 'ja_return_blank' ); function ja_return_blank() { return ''; } /* Forum Description Removal End */March 2, 2015 at 1:09 am #159129In reply to: Remove Forum Boxes – See Inside for Screenshot
Robkk
Moderatorthe bbcodes notice i think you can turn that off in the plugin your using, i think its gd bbpress tools.
you can remove the unrestricted html notice with some CSS if you want its only displayed to Admins/Keymasters only, so its not that big of a deal.
you can use this PHP code to remove the notice above the topics/forums
add_filter( 'bbp_get_single_forum_description', 'ja_return_blank' ); add_filter( 'bbp_get_single_topic_description', 'ja_return_blank' ); function ja_return_blank() { return ''; }March 2, 2015 at 12:49 am #159128In reply to: Remove Forum Boxes – See Inside for Screenshot
Alice Kaye
ParticipantFigured out the avatar issue itself.
Basically used the following code (though this may not work for everyone – not sure if it’s based on theme):
#bbpress-forums div.bbp-forum-author img.avatar, #bbpress-forums div.bbp-topic-author img.avatar, #bbpress-forums div.bbp-reply-author img.avatar { border: none; max-width: 100%; padding: 0; margin: 12px auto 0 auto; float: none; } #bbpress-forums p.bbp-topic-meta img.avatar, #bbpress-forums ul.bbp-reply-revision-log img.avatar, #bbpress-forums ul.bbp-topic-revision-log img.avatar, #bbpress-forums div.bbp-template-notice img.avatar, #bbpress-forums .widget_display_topics img.avatar, #bbpress-forums .widget_display_replies img.avatar { float: none; margin-bottom: -7px; border: 3px double #ddd; width: 15px; height: 15px; }March 1, 2015 at 7:24 pm #159125In reply to: pimp your Press | What does it mean
Robkk
Moderatori creep BuddyPress forums here and there , but yeah i read that topic
i think someone brought this up awhile ago on the #bbpress slack channel too. Specifically the Pimp your Press forum.
i don’t think its really a hierarchy issue and more about people not knowing exactly what a forum is for and how they interpret it to be.
For example one user could think that Pimp your Press could be to “show off your bbPress installation” to another it could be “How could i tweak/design my bbPress installation?”
i think they should just bring back the descriptions of the forums and place them sort of like they did in 2011 in the link i posted above, so that users know what exactly the forum is for.
As for bbpress.org changing the forum archive to a different layout, who knows. It does look real nice how it is now and like i said i don’t hierarchy is not really a problem, but if they did change it i think they would because they had the same layout for a couple of years.
oh and the epicwebs theme hierarchy is not part of core , the developer just did a cool function to use bbPress’s code to look that way. There is i think 2-3 ways to do that type of hierarchy, and the other two ways are in a bbpress trac ticket scheduled to be in a future version of bbPress.
March 1, 2015 at 7:21 pm #159124Topic: Remove Forum Boxes – See Inside for Screenshot
in forum TroubleshootingAlice Kaye
ParticipantHi guys!
I was wondering if it was possible to remove the info boxes from within forums. One of which announces how many topics have been created recently, with an avatar, and the other says “You can use BBCodes to format your content,” etc. etc, though that may be something from a plugin (for all I know).
Example: http://screencast.com/t/zo2nX63Q
Any help, especially on the blue box at the top, is so, so appreciated! Thanks!
March 1, 2015 at 6:26 pm #159122In reply to: When I post a topic I get error404 page
Robkk
Moderatorwell i see your forum url links have double slashes in it
<a href="http://www.nadirkitaplar.net/forums//genel/">Genel</a>did you edit the slugs in settings>forums
March 1, 2015 at 5:53 pm #159121In reply to: Author avatar floating top-left
Robkk
Moderatortry this
@media only screen and (max-width: 480px) { #bbpress-forums div.bbp-reply-author img.avatar { position: relative; width: 60px; height: auto; } }March 1, 2015 at 1:55 pm #159113In reply to: Add Custom User Roles
Alice Kaye
ParticipantYeah, I’ve been using /**/ for all of my commenting, but I really like the // style for one line comments, so I’m going to move everything over to that format.
I try to label everything both for OCD reasons and simply for the exact reason you mentioned. I don’t want to find myself wondering in the future what the heck the code was placed for! š
March 1, 2015 at 1:45 pm #159111In reply to: Add Custom User Roles
Robin W
Moderatorit’s also great when you come back to the code two months later and can’t remember what it does !
March 1, 2015 at 1:41 pm #159110In reply to: Add Custom User Roles
Alice Kaye
ParticipantYou know, I kept seeing that throughout the code and thought that was pretty awesome. I will definitely make use of that! It’s a lot easier and cleaner looking and 9 times out of 10, I don’t need two lines.
Thank you for the tip! š
March 1, 2015 at 1:39 pm #159109In reply to: Add Custom User Roles
Robin W
Moderatordon’t forget you can use
/* xxx */ or
//to make comments throughout your code
// only does a single line
/* this
does
multiple lines
*/so you can have
//Add the Artisan role $bbp_roles['my_custom_role5'] = array( 'name' => 'Artisan', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); // Rename the Moderator role $moderator = bbp_get_moderator_role() ; $bbp_roles[$moderator] = array( 'name' => 'Councilman', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); );March 1, 2015 at 12:18 pm #159103In reply to: Add Custom User Roles
Alice Kaye
ParticipantSo, follow-up question to that then…
Would it have been wrong to modify them to say bbp_craftsman, bbp_journeyman, rather than my-custom-role-1, my-custom-role-2? Does this have some bearing on the code, aside from a name, that I’m not understanding?
I saw that you had used the original code with my-custom-role-1/2/3/etc, and modified them back to the bbp_name, thinking it was simply just a name. If it’s more than that, I’d love to know.
March 1, 2015 at 12:15 pm #159102In reply to: Add Custom User Roles
Robin W
ModeratorHope Iām grasping that correctly.
nearly
I scrapped part 2, then
what I actually did was take the final three roles form your original part 1 (I moved the participant one down to make it consistent)
so if you look at the councilman role
Then where you had
$bbp_roles['my_custom_role6'] = array( 'name' => 'Councilman', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster );This will set a role called my-custom-role-6 to the name and capabilities, and if that role doesn’t exist will create it. WordPress generally doesn’t worry about whether something already exists, if it does it overwrites it, and if it doesn’t it creates it.
Now I could have simply changed ‘my_custom_roles_6 to bbp_keymaster, and it would have changed the existing role bbp_keymaster name and capabilities to what was in that line
But for reasons I won’t bore you with, it is better to call a function which gets that role
hence the new line before
$keymaster = bbp_get_keymaster_role() ;Then you just use that $keymaster variable set in the line before
March 1, 2015 at 12:11 pm #159101In reply to: Add Custom User Roles
Alice Kaye
ParticipantIt’s really great to know that you’ve learned this much in two years. I have hope for me yet of understanding this!
What I see that you did was move
return $bbp_roles;from the middle of the code, down to the bottom, while also removing the secondary and unnecessary function and filter, keeping only the'add_custom_role'portion of the function/filter.I am definitely curious as to how it’s working without the
'ntwb_bbpress_custom_role_names'filter, for the renaming of the roles? As I write this, I’m not even sure how to explain the question I have. Haha.But I thank you for all of your help. You’ve been absolutely fantastic and I appreciate all of the information.
This was actually a ton of fun, despite my code not working out without your help. As someone who has a deep interest in web design (I do it for a living, without the code-end of things), I think this has fueled me into wanting to learn more about how this works and delve deeper! š
March 1, 2015 at 11:57 am #159100In reply to: Add Custom User Roles
Robin W
Moderatorwell worth getting into php if you plan to do customisation, and yes have a look and see if you can work out what I did.
The key is that a function can only have one ‘return’ command. The WHOLE of the second functioj is one long return command (it starts with it). so I just amended the first one from of creating the final three roles, to calling up the existing roles and then overwriting them
Have fun, and come back with any queries – it was only two years ago that I wrote my first line of php code, and I only do this very part time!
March 1, 2015 at 11:57 am #159099In reply to: Add Custom User Roles
Alice Kaye
ParticipantSo basically, am I to understand correctly that you simply removed:
/* bbPress Custom Role Names */ add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' ); function ntwb_bbpress_custom_role_names() { return array(Which then left you with one function and one filter, but due to the way the code is written for the base three roles (keymaster, moderator and participants), that code is changing their name, regardless of the function and filter?
Hope I’m grasping that correctly.
March 1, 2015 at 11:51 am #159098In reply to: Add Custom User Roles
Alice Kaye
ParticipantOh wow, you got that written up fast! I re-wrote my response to you about 10 times while you were modifying that. I’m going to look through and see what you changed, so that I can learn the differences between the two pieces of code.
Thank you so much for modifying it! I’ll add it now and see how it pans out.
March 1, 2015 at 11:50 am #159097In reply to: Add Custom User Roles
Alice Kaye
ParticipantHi Robin,
Thank you for that link. It does answer some questions, but presents many more, probably since I don’t have any foundation (personally) in PHP. This is the first time I’ve ever tried to write/modify something in PHP and actually have it work.
I understand having one filter and one function and that they’re essentially both trying to grab the attention of
bbp_get_dynamic_rolesif both are present. I also now understand that by trying to merge them, that’s impossible because it needs to be 1 v 1, not 1 v 2. But if I can only have 1 function and 1 filter, I’m then left wondering if this can be written in some way to encompass both things that I’m trying to accomplish.March 1, 2015 at 11:47 am #159096In reply to: Show latest reply author name
Robin W
Moderatoroops, yes I should code it to go to that, I’ll do an amend !
March 1, 2015 at 11:47 am #159095In reply to: Add Custom User Roles
Robin W
Moderatorok, so the following combines what the first does with what the second does and achieves what you want
/* bbPress Custom Roles */ function add_custom_role( $bbp_roles ) { $bbp_roles['my_custom_role2'] = array( 'name' => 'Craftsman', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['my_custom_role3'] = array( 'name' => 'Journeyman', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['my_custom_role4'] = array( 'name' => 'Adept', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); $bbp_roles['my_custom_role5'] = array( 'name' => 'Artisan', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); $moderator = bbp_get_moderator_role() ; $bbp_roles[$moderator] = array( 'name' => 'Councilman', 'capabilities' => bbp_get_caps_for_role( bbp_get_moderator_role() ) // the same capabilities as keymaster ); $keymaster = bbp_get_keymaster_role() ; $bbp_roles[$keymaster] = array( 'name' => 'Advisor', 'capabilities' => bbp_get_caps_for_role( bbp_get_keymaster_role() ) // the same capabilities as keymaster ); $apprentice = bbp_get_participant_role() ; $bbp_roles[$apprentice] = array( 'name' => 'Apprentice', 'capabilities' => bbp_get_caps_for_role( bbp_get_participant_role() ) // the same capabilities as participants ); return $bbp_roles; } add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 );March 1, 2015 at 11:36 am #159094In reply to: Add Custom User Roles
Robin W
Moderatorok, quick answers and I’ll come back in a short while
a filter is a way to alter core code without having to change the core files. In effect if a function on the core is called ‘fred’ and writes the word ‘fred’ to your screen, then (as long as the function author has left the right code in there) you can write a filter to change ‘fred’ to ‘bert’ by adding a function (say a function called Bert) that writes ‘bert’ and then ‘add filter(‘fred’,’bert’) tells the system to ignore the fred function and put in the bert function, so it writes bert.
Now you have two filters which are overwriting what the core code in ‘bbp_get_dynamic_roles’ does, so in your original code you only had one filter so was fine.
In your second version, the first filter did the new roles, but the second filter to the same code overwrites the first (thus nullifying it) , so you were just left with the second one working.
bit like
original says write Fred
First filter says write Bert
Second filter says write HarrySo the code writes only Harry
BUT simply combining the two won’t work either as a filter has to return something and only one thing, so the code will quite as soon as it encounters a ‘return’ command.
Since the first half has ‘return $bbp_roles; ‘ it quits at that point and the second half isn’t exectuted.
So we need one function with one return and one filter (you actually can have more than one filter, but that’s more advanced!) – I’ll now go and look at it
see also
March 1, 2015 at 11:19 am #159093In reply to: Add Custom User Roles
Alice Kaye
ParticipantOkay, so I tried to modify the function, to merge the two and that didn’t work, so I have a few questions:
From this:
add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 1 ); add_filter( 'bbp_get_dynamic_roles', 'ntwb_bbpress_custom_role_names' );To this:
add_filter( 'bbp_get_dynamic_roles', 'add_custom_role', 'ntwb_bbpress_custom_role_names' 1 );But that didn’t work at all, wound up immediately getting an error.
Should I perhaps be placing the renaming of the base three roles, before the creation of the new four roles? The filter for the creation of the roles comes after all of them are created but the filter for the role name change comes before the changes, so I wonder if the two filters would still conflict if I moved them around?
These are really newbie questions, I know, but I am not 100% sure as to how to change these to work in tandem.
Thanks in advance for any help you can provide!
-
AuthorSearch Results