Search Results for 'code'
-
AuthorSearch Results
-
August 20, 2021 at 3:36 am #222673
In reply to: Register custom view with extra_fields
specstanza
ParticipantThank you @robin-w !
My first idea was todisplay:none
the_title but I’m definitely going to keep it.I found the solution by installing a plugin called Hookr. It gave me some informations I needed after hours reading Bbpress’ files.
The ouput is a bit strange though…
As if the voice-count moved somewhere. The author is also displayed twice – I don’t remember it was like that before. Changing the shortcode used doesn’t improve this.
I’m going to figure out what happened here and keep this thread updated if it’s usefull for someone. π
August 19, 2021 at 1:17 pm #222667In reply to: Catering for when users simply reply to emails
Robin W
ModeratorAtleast one that says it officially supports the latest wordpress version that is out.
I thought it now did – certainly here
August 19, 2021 at 12:48 pm #222664In reply to: Is it possible to change a Forum author?
Robin W
Moderatorinteresting – yes that is not there in the front end
If you have skills with accessing the database then you can easily change it there, let me know and I’ll give you some help.
Otherwise come back with the numbers of the forums you want to change (you can see this in the url of the page when you edit a forum – eg
https://www.mysite.com/wp-admin/post.php?post=2927&action=edit
is shown for forum number 2927
so give me a list, and the user ID of the author you want to change them to, and I’ll give some some code
August 19, 2021 at 12:42 pm #222663In reply to: Register custom view with extra_fields
Robin W
Moderatorthanks for posting your solution.
you could do
add_action('bbp_theme_before_topic_title', 'show_true_title'); function show_true_title() { $topic_id = bbp_get_topic_id(); $true_title = '<li class="specstanza-title"><a href="' . get_permalink() . '">' . get_post_meta( $topic_id, 'bbp_extra_field1', true); '</a></li>'; echo $true_title ;
and then in css do
li.specstanza-title { color: blue; }
or
.specstanza-title { color: blue; }
or
.specstanza-title li { color: blue; }
one of those should let you style the title
August 19, 2021 at 11:30 am #222662In reply to: Register custom view with extra_fields
specstanza
ParticipantTo anyone who would come accross the same project, I added an action to the
bbp_theme_before_topic_title
hook.For now, it does not displays as I would like but some CSS will do the trick.
add_action('bbp_theme_before_topic_title', 'show_true_title'); function show_true_title() { $topic_id = bbp_get_topic_id(); $true_title = '<li><a href="' . get_permalink() . '">' . get_post_meta( $topic_id, 'bbp_extra_field1', true); '</a>'; echo $true_title ;
August 19, 2021 at 4:07 am #222656In reply to: Catering for when users simply reply to emails
Robin W
ModeratorThe problems with this are multiple. Emails to site go into a mailbox – emails and web are separate – eg you can host you email with a totally different supplier, so in essence there is no ‘web software’ to catch an incoming email. So firstly the mailbox would need to exist on a mail server somewhere.
Next you’d need software on the email to look at all incoming, read the mail, work out if this is a reply, and to what message, check the sender’s mailbox to work out which user it is, and then get this software to send to another programme within the website, which can then create the reply.
The ability for spam and people pretending to be a user are numerous.
Github is created by very clever people, who have I presume done all this, but there would be a lot of code in many languages to achieve.
If it is an issue, then I’d suggest you amend your sending email to omit the actual content – so something like – ‘a new reply has been received, click here to read’ so that people have to click the link and are on the site to see content to reply to.
August 17, 2021 at 11:04 am #222625Topic: How to Remove ‘Create New’ Form at The End of Forums
in forum Installationdivepen
ParticipantI tried using a string of codes someone posted here, but I couldn’t follow through.
So, can anyone direct me on how to remove that form at the end of forums and topics?Take this BBPress website for example. The create New Topic takes us to the new page. But it’s not hanging below.
August 15, 2021 at 3:46 am #222603Topic: Register custom view with extra_fields
in forum Themesspecstanza
ParticipantHi everyone,
I’m using the bbp_register_view_popular for the homepage of my offline website.Works pretty well to sort_by my meta_value.
What I’m trying to do is to return a custom field as the main title.
I’m already doing this on custom pages and it works like a charm, here is my code :$output .= '<li><a href="' . get_permalink() . '">' . get_post_meta(get_the_ID(), 'bbp_extra_field1', true) . '</a></li>';
How can I return the same thing in my custom_view for my homepage without actually changing permanently the_title from WordPress?
the_title
is absolutly needed andbbp_extra_field1
works a subtitle.Many thanks to anyone who could put me on the right way π
August 13, 2021 at 1:00 pm #222585In reply to: User/Member Directory
egemenerd
ParticipantI know this is an old topic but if anyone is interested in, we made a plugin for this; https://codecanyon.net/item/tmusers-bbpress-forum-member-directory-for-elementor/33463523
August 12, 2021 at 5:40 pm #222573jappan
ParticipantThe profile above is from the login-widget, and the profile below is from my php code.
However, it doesn’t not have a link to the user’s profile.I would like to add a link to the profile screen in the image and username like above one!!!
please teach me…
i’m sorry for the inconvenienceAugust 12, 2021 at 5:26 pm #222572jappan
ParticipantThank you Mr.Robin!!!
I tried using PHP code to put this button in place.
βHere is the codeβ<!DOCTYPE html> <html lang="ja"> <head> <div class="login-box"> <?php if ( is_user_logged_in() ) : ?> <?php bp_loggedin_user_avatar( 'type=thumb&width=40&height=40' ); ?> <?php global $user_identity; echo $user_identity; ?> <a href="<?php echo wp_logout_url( bp_get_root_domain() ) ?>">γγ°γ’γ¦γ</a> <?php else : ?> <a href="https://tokyolyric.com/wp-login-php">γγ°γ€γ³</a> <?php endif; ?> </a> </div> </head>
but I can’t go to “user’s profile page” from “the user’s image” and “user name”.
please let me know if there is any description to add to the code!!!
August 7, 2021 at 4:39 am #222497In reply to: Tag cloud on search result page
Jan
Participantsorry for making you wait.
The better term is probably “search result page”. The header of my bbp forum comes with a search bar which allows users to enter keywords (i.e. “browser”) and then takes then to the respective search result page (example: https://webgefaehrte.de/videoassistent/suchen/browser/).
I’d like to add a tag cloud into the existing side bar (right hand side).
Meanwhile I found this suggestion which, however, I can’t get to work π
The threats regarding #1 und #2 is this one:
– https://bbpress.org/forums/topic/problem-with-shortcode-tag-cloud-in-sidebar-widget/
– https://bbpress.org/forums/topic/change-font-size-range-for-tag-cloud/Any advise is much appreciated.
Thanks,
JanAugust 7, 2021 at 2:56 am #222494In reply to: Forum url changes
Robin W
Moderatorok you could also use a PHP variable rather than a wordpress function
so
$current_url = $_SERVER['REQUEST_URI'];
should give you the displayed URL in all cases.
you can then do an ‘if’ test to see if you are in forums using say
if (strpos($_SERVER['REQUEST_URI'], '/qaforums/') == true )
…then you are in the forumsAugust 6, 2021 at 4:17 pm #222472In reply to: Forum url changes
pawanahluwalia
ParticipantI am just trying to understand how the plugin works and why the php code is not giving the correct url that matches what is visible in the browser. I have tried your suggestions but I still can’t determine why the urls being generated by either get_page_link() or get_permalink() are different to the ones being displayed in the browser address line.
August 6, 2021 at 4:08 pm #222471In reply to: Forum url changes
Robin W
Moderatorsorry, I have given you some code which addresses, which does not seem to satisfy you.
I am not quite sure why you think the plugin authors would want to make their plugin work for your exact circumstances, but if you want to post a defect then go here
August 6, 2021 at 2:57 pm #222463In reply to: Forum url changes
Robin W
Moderatorwould you like to post your current code?
August 6, 2021 at 2:12 pm #222462In reply to: Forum url changes
pawanahluwalia
ParticipantThe only trouble with this solution is, it is not permanent. You would need to the change the code each time a new forum is added.
August 6, 2021 at 12:21 pm #222459In reply to: Forum url changes
Robin W
Moderatorif get_page link returns :
mywebsite.com/forum_name3/forum_name3/
then you could just test for this eg
if (get_page_link() == 'mywebsite.com/forum_name3/forum_name3/') { get_permalink etc. } else { get_page_link() }
August 6, 2021 at 12:06 pm #222458In reply to: Forum url changes
pawanahluwalia
ParticipantThanks!
However, is_bbpress() only seems to be true if you are on the root forum page.
How can I test for any forum page?
I tried
echo get_permalink();
on a forum page, but it does not display anything. It does display it on the root forum page, but it does not match the root forum page permalink. It again shows the highest Forum ID permalink instead.
Presumably the page is being created in code and is overwriting the content of the current forum page.
Any further suggestions?
August 6, 2021 at 10:58 am #222455In reply to: Forum url changes
Robin W
ModeratorI’d suspect that because each forum is not an real individual wordpress page (ie not in dashboard>pages) , then retrieving the page_link might well return a ‘virtual’ ID, and this might be the top forum – not proven, just a hunch.
My initial suggestions would be that you try get_permalink instead of get_page_link() – this retrieves the full url of the current displayed page, and should in theory get you what you want.
If you need the existing get_page_link() for your other pages, you could try wrapping it in an if… eg:
if (is_bbpress()) { get_permalink etc. } else { get_page_link() }
Let us know if that helps
August 5, 2021 at 11:42 am #222427packzap
ParticipantMy server is showing this error repeatedly:
“PHP Parse error: syntax error, unexpected ‘new’ (T_NEW) in /home/…/bb-settings.php on line 188”When I look at line 186 thru 190 of bb-settings.php, it shows this statement:
// Setup the global database connection $bbdb_class = BB_DATABASE_CLASS; $bbdb =& new $bbdb_class( array( 'name' => BBDB_NAME, 'user' => BBDB_USER,
I am trying to troubleshoot what it is about that line with the “new” statement that causes this parse/syntax error repeatedly by the server. Any thoughts are appreciated. Thank-you.
August 5, 2021 at 8:40 am #222425In reply to: Get Number of Favorites & Subscription to a topic
specstanza
ParticipantThank you so much @robin-w – changed the subscription to fav with
bbp_get_topic_favoriters
πadd_action('bbp_template_before_single_topic', 'show_bbp_sub'); function show_bbp_sub() { $subscriptions = bbp_get_topic_favoriters(bbp_get_topic_id()) ; $count = count($subscriptions) ; echo 'number of users subscribed: '.$count; }
Now I only have to look for a way to display my topics and sorted them by numbers of favs! Thanks to you I know there was some major changes with the 2.6 version.
August 5, 2021 at 8:27 am #222424In reply to: Get Number of Favorites & Subscription to a topic
Robin W
ModeratorI’ve just taken a look – the whole way subscriptions works was changed in 2.6
this code works on my test site
add_action('bbp_template_before_single_topic', 'show_bbp_sub'); function show_bbp_sub() { $subscriptions = bbp_get_subscribers(bbp_get_topic_id()) ; $count = count($subscriptions) ; echo 'number of users subscribed: '.$count; }
August 5, 2021 at 6:19 am #222416In reply to: Get Number of Favorites & Subscription to a topic
specstanza
ParticipantHi @robin-w – thanks for your answer.
Here it is – as I’m still learning PHP, I apologize if I did a terrible coding mistake.
I tried some modifications here and there (return, echoing other stuff) but nothing did the trick./* tried to hook the code in my template */ add_action('bbp_template_before_single_topic', 'show_bbp_sub'); function show_bbp_sub() { /* end of it */
/* Original lines from @babblebey */ $topic = bbp_get_topic_id(); $users = get_users() ; $countsub = 0; /* I guess it's echoing only this line */ foreach ($users as $user) { $topicsub_listarray = get_usermeta ($user->id, 'wp__bbp_subscriptions', true) ; $topicsub_list = explode (',' , $topicsub_listarray) ; if (in_array ($topic , $topicsub_list)) $countsub++ ; } echo $countsub; }
Thank you for your help and your patience.
August 5, 2021 at 2:57 am #222407In reply to: Get Number of Favorites & Subscription to a topic
Robin W
Moderatorcan you post the complete code
-
AuthorSearch Results