Search Results for 'code'
-
AuthorSearch Results
-
August 7, 2007 at 12:41 pm #59811
In reply to: bbPress Login from WordPress
fel64
MemberCan you link us to it?
The login functions that logs you into bb redirect you to the forums. It may be possible to change that behaviour but I’m not immediately sure how – probably using an action or filter, possibly the action
bb_user_login.August 7, 2007 at 10:42 am #59825In reply to: How do you change the Freshness of post date format?
_ck_
ParticipantRemember that the date will be relative to worldwide visitors unless you list the timezone (which will be meaningless to people far outside the timezone).
What I do on some code is list the freshness in plain english but make the title of the element the original time.
ie.
<span class=timetitle title="<?php echo date("r",strtotime($topic->topic_time)); ?>"><?php topic_time(); ?></span>Then when you mouse over the “3 days ago” it will show you the original time (in mysql format which can be changed). Then use CSS to make a light underline so the user knows it has some kind of function.
August 7, 2007 at 9:18 am #59824In reply to: How do you change the Freshness of post date format?
Ziyphr
Memberhttp://uk3.php.net/manual/en/function.date.php
Don’t have access to the code right now so not sure where in bbPress you need to edit.
August 7, 2007 at 4:03 am #59848_ck_
ParticipantLooking quickly at the code, I can’t believe this a no action hook when a post is spammed or a user is bozoed. Bad planning. So we can’t make a plugin for that directly. But we could periodically scan for both situations, or check after every post is done.
Actually what I want is more fancy, an internal popup alert system when certain actions have occurred so email isn’t even needed and is just optional. As you are browsing your site, you’d find out instantly if something like that happened and given a link to look at/take care of it. Plugin authors would be able to add to the alert queue instead of just emailing. Both mods and admin could be alerted individually based on situations.
August 7, 2007 at 3:49 am #59716In reply to: how do I add a custom template name to bbpress?
_ck_
ParticipantA really neat trick would be not to have a physical template at all but pass it data. My entire template just consists of
<? bb_get_header();bb_list_plugins();bb_get_footer(); ?>Which seems silly to have a physical file.
I guess I could try to hook it after the init and bypass the bb_load_template entirely.
August 7, 2007 at 1:59 am #59715In reply to: how do I add a custom template name to bbpress?
Sam Bauers
ParticipantI’m pretty sure you can call any file using the
bb_load_template()function, so you can keep your files all neatly bundled up in your plugin directory.There are various was you can work out where your plugin is located, and if your template file has a predictable location relative to that, it should be easy to refer to it in the
bb_load_template()function.August 7, 2007 at 1:34 am #51598In reply to: Google Adsense
fel64
MemberLook for blank lines or spaces before the starting
<?phpand after the ending?>as they can cause that problem.August 6, 2007 at 9:47 pm #2211Topic: How do you change the Freshness of post date format?
in forum ThemesInquirer
MemberWhat is the code to change the Freshness of post format to the Date – Hours – Minutes ?
August 6, 2007 at 4:45 pm #59714In reply to: how do I add a custom template name to bbpress?
_ck_
ParticipantYup! Solved it… and a nice way too…
To have a custom template attached to a view, ie.
/forums/view/listplugins
function view_listplugins($view) {
if ($view=="listplugins") {bb_load_template( 'list-plugins.php'); exit();}
} add_action( 'bb_custom_view', 'view_listplugins' );
function view_listplugins_filter( $views ) {
global $views;
$views['listplugins'] = "List Plugins Used";
return $views;
} add_filter('bb_views', 'view_listplugins_filter');Now the question is, will this work in the trunk since they completely changed how views are done…
THE ANSWER IS YES! WOOHOO!
http://bbpress.nfshost.com/forums/view/list-plugins
So we have a way to attach any custom page to bbpress.
The only catch is it will show up in the views list.
But you can filter the views list for admin/mods, etc.
I think I can make my “my-views” plugin work with the trunk with this “feature”.
August 6, 2007 at 4:26 pm #59713In reply to: how do I add a custom template name to bbpress?
_ck_
Participants010, that’s very clever.
Unfortunately it doesn’t work.
Not certain if slugs would translate either,
ie. /action/listplugins
I think the shortest shortcut is a universal loader could be made for all future extensions, ie.
/forums/option/listplugins
where option is really option.php in the bbpress root and it just passes to the template listplugins.php
This would have to be made in the the bbpress core of course.
ooooh I just had an idea… where is the hook for bbpress’s internal 404…
er, no i guess that won’t work either…. BUT
take a look at view.php in the bbpress root
you can hook bb_custom_view
basically since there will not be any view name, it won’t do the mysql call, then after you catch it on the do_action(‘bb_custom_view you can exit() after your own custom page load.
ie. /forums/view/listplugins
Let me try to code something working…
August 6, 2007 at 3:42 pm #59711In reply to: how do I add a custom template name to bbpress?
so1o
Participantthis is what i think can be done.. very hacky and very primitive
create a plugin which filters ‘bb_template’ for template ‘front-page.php’. check for $_GET == listplugins. if so return list-plugins.php
that will load list-plugins.php is the user goes to
go to <bbinstall>/index.php?action=listpluginshere is the plugin
add_filter(‘bb_template’,’my_plugin_change_template’);
function my_plugin_change_template($template) {
return ( ‘listplugins’ == $_GET ) ? ‘list-plugins.php’ : $template;
}
kapish?
August 6, 2007 at 2:29 pm #2204Topic: how do I add a custom template name to bbpress?
in forum Plugins_ck_
ParticipantFrom within a plugin I wanted to attach a new template/page name within the bbpress structure but I cannot figure out how to do it?
For example:
Let’s say I want to have a custom page called “list-plugins”
http://bbpress.nfshost.com/forums/list-plugins
The only way I was able to do this was to create new file in the bbpress root like this and save it as list-plugins.php
<?
require('./bb-load.php');
$bb_db_override = false;
do_action( 'bb_index.php_pre_db', '' );
do_action( 'bb_index.php', '' );
bb_load_template( 'list-plugins.php');
?>Then that would load list-plugins.php in my template folder.
But can’t I attach a fake template name to bbpress via it’s rewrite system without having a physical file?
August 6, 2007 at 1:22 pm #59377In reply to: paragraph breaks bust loose
fel64
MemberThat sort of thing is usually when you’re not closing
divs orliand each successive one falls into the previous, but that should show up in FF and IE too. I looked for that but couldn’t see it, so I can’t help you. Maybe have a look around for Safari bugs that could cause this?August 6, 2007 at 1:12 pm #59809In reply to: bbPress Login from WordPress
fel64
MemberIt does indeed require a deeper level of integration. You want to load bb when you load wp, so open wp’s
wp-config.phpand add the following line:require_once('./bbpress/bb-load.php');where
/bbpress/should be the subdirectory of wordpress that bb is in. If that works you should now be able to call any bb function from wp.August 6, 2007 at 6:57 am #59803In reply to: Which filter/action hook should I use?
howtogeek
MemberThat got me thinking… why reinvent the wheel when I can just use the bbcode plugin.
What I did was change the current quote plugin to insert the quote with
Quote:instead of the other syntax, as well as strip out any blockquotes from the original post that you are quoting, which eliminates the multiple levels of quoting.So here’s my new bb_quote_message() function:
function bb_quote_message() {
global $bbdb, $topic;
$post_id = (int)$_GET['quote'];
if ($post_id) {
$row = $bbdb->get_row("SELECT * FROM $bbdb->posts WHERE post_id={$post_id} AND topic_id={$topic->topic_id} AND post_status=0");
$row->post_text = preg_replace( '(<p>|</p>)', '', $row->post_text );
$ret = preg_replace("/<blockquote>((.|[nr])*?)</blockquote>/", "",$row->post_text);
if ($row) echo htmlentities('', ENT_COMPAT, 'UTF-8');Quote:'.$ret.'
}
}So far it works great… except it’s annoying that the cursor isn’t positioned at the end of the textbox… I’m gonna look for some javascript to fix that.
August 6, 2007 at 5:55 am #59802In reply to: Which filter/action hook should I use?
_ck_
ParticipantJust remember some people use the bbcode plugin so it would have to peacefully get along with that.
August 6, 2007 at 5:34 am #59801In reply to: Which filter/action hook should I use?
howtogeek
MemberI’d think it would work out much better to use something other than blockquote… that’s the whole idea behind the
Quote:tag… it should be accepted by bbpress perfectly fine, and not used for any other reason.There’s no reason to have full bbcode support if you don’t need it, all we need is the
Quote:tag.One of the problems with using blockquote is that somebody might already use blockquote in their posts. It would also make any old posts using blockquote completely incompatible with the new plugin.
Otherwise you could use another tag, but then you have to modify the bbpress allowed tags list.
And the issue here is that we are trying to indicate to the system that we are quoting something, not just trying to format the display. It’s this that gives us the ability to filter out the first quote in a multiple-quote scenario that probably happens very often.
August 6, 2007 at 5:29 am #59800In reply to: Which filter/action hook should I use?
_ck_
ParticipantWell you’d have to use an existing html tag like blockquote and map it to a bbcode tag via another plugin.
But blockquote can have made-up attributes.
ie.
<blockquote post="1824" author="_ck_">blah blah</blockquote>But it’s much more simple to start with non-intelligent quoting. You can place the post reference but to look for it and analyse it is much more difficult.
Stripping nested blockquotes will be very easy.
Well fairly easy.
August 6, 2007 at 5:23 am #59798In reply to: Which filter/action hook should I use?
howtogeek
MemberI am pretty busy at the moment… and you are rather amazing at creating these plugins…
I was thinking that when generating the quoted text it would show up at the top of the textarea like this:
|
Quote:so you really like ascii?| that’s pretty cool
|
| Yeah, I love ascii… I’m a geek, afterall
When generating that quoted text, it would be necessary to find an existing quote within the post and remove that, so the quote of a post that quotes another post then would only have the actual post. (boy was that confusing) It should be simple enough to remove anything between
Quote:Then on display there should be a hook to find a pair of
Quote:and replace it with a div that we can then style correctly. By only allowing a pair then you would prevent breaking divs. If the post submitter screwed up the
Quote:tags, then their post would just not make sense, but wouldn’t break the design of the page.This is similar to the way invision does it, and it seems like a reasonable way to handle it.
Make sense?
August 6, 2007 at 5:10 am #59797In reply to: Which filter/action hook should I use?
_ck_
ParticipantLook again at this tonight I see all the magic would have to happen in “post-form.php” and unfortunately it would need a simple edit.
<textarea name="post_content" cols="50" rows="8" id="post_content" tabindex="3"></textarea>would have to be edited to something like
<textarea name="post_content" cols="50" rows="8" id="post_content" tabindex="3"><? quote_post(); ?> </textarea>Even though there is
do_action( 'post_form_pre_post' );just above it, there is no way to manipulate the textarea content without javascript. It’s a shame they didn’t think of that.So quote_post() could just look for the added arg to the URL and insert the formatted quoted text in the textarea. Then a simple quote button on each post in the topic to trigger the new post.
ie.
?new=1"e_post=1873
If you don’t write it, I’ll take a shot at it.
August 6, 2007 at 2:35 am #59808In reply to: bbPress Login from WordPress
avatarx
MemberThanks for both your replies. I’d read that thread previously and my impression was that it is overly complex for what I’m trying to accomplish and was hoping for a much simpler way. I’d rather avoid having to “hack core files” as described and I want to be able to upgrade both WP and bbPress easily with changes only in my template files. I also don’t need the complex behavior of conditionally showing admin links, etc. since I just bookmark the admin page. And finally, as I mentioned, my PHP skills are non-existant at this point so not the kind of thing I am comfortable taking on right now.
fel64, currently I have my user tables and cookies integrated. I installed bbPress within the WP directory to get the easy integration described in the docs since I’m still pretty new to both. So far that seems to work great. I like your suggestion of just grabbing the HTML code for the WP login and making it look like the bbPress login. That would solve the login part of it. However, then I would need some conditional code to display different things if the user is logged in or not, similar to what the bbPress login form does. It displays the welcome and profile link if logged in, or login form if not. For new user registration I’d have to send them to the bbPress registration page because I want them to fill out profile info not available in the WP registration form since it only asks for username/pw. Then I think it would be kind of weird that the user clicks register from the home WP page and gets taken to the forums after they register. Probably have to do some special handling there to see where they came from and send them to the right place.
So…. hope you don’t mind the thinking outloud but after all that I’m wondering if it’s all worth the trouble given how unfamiliar I am with these systems. Maybe I’ll postpone this until future versions of bbPress make login integration much easier or there are plug-ins written for WP that can help. My initial thought was, why can’t I just call the login form code from bbPress from WP? Is this something that requires a deeper level of integration than what I have? I’m curious about this in general as it would be something I’d like to be able to do in the future.
Thanks!
August 5, 2007 at 10:34 pm #59700In reply to: A forum just for art teachers
dawnsbrain
MemberYes, I do have that add-on. I used it in creating nhsdesigns.com.
Again, I used a theme from elsewhere, so I will try to validate it when I get some extra time.

Thanks!
August 5, 2007 at 7:45 pm #59790In reply to: plugin: bb-Polls
Null
MemberWhaha i had some nice skins, 4 years ago, never took the time to cancel the .com
That plugin of mine is still so buggy (and not working) it proberbly caused the 2 launches of topicmeta. To be honest, if I told you what I wanted to create, you’d fix it in 1 day i guess. I still need to reverse engineer it, learn how stuff works and puzzle it togther. Working on it for 2 weeks now, no working results yet



But I’ll get it right…. ever……
August 5, 2007 at 7:02 pm #59787In reply to: plugin: bb-Polls
_ck_
ParticipantOh that was immediately more helpful than anything else I’ve asked or you’ve answered. There is something really strange going on in that the code is being inserted twice. Some hook is firing twice when it should only be once. I have to investigate.
Er, What other plugins do you have running?
I see your bbmenu in there.
Can you try deactivating everything?
Also, post your post.php template in code tags here – are you positive it’s stock?
I think I know exactly what is happening but I don’t know why.
My plugin hooks topicmeta
add_action('topicmeta','bb_polls_pre_poll');Topicmeta can only happen once on a topic page.
Somehow it’s firing more than once on your page.
Deactivate all other plugins for a minute just to make sure something doesn’t have a major bug.
Try this experimental fix which unhooks itself after the first execute to prevent a second run:
August 5, 2007 at 6:15 pm #52689In reply to: Plugin: [REL] Signature
_ck_
ParticipantI doubt I will add lines/characters countdown meters anytime soon but will keep them in mind. The Polls plugin is my top priority for now as I don’t even allow signatures on my own sites.
I’ll look into the stylesheet bug though.
To see a signature somewhere else you’d have to call
echo add_signature_to_post('');which might work but won’t apply other bbpress filters to it. It also needs to know the post and user id from $bb_post so if it’s outside the loop it won’t work at all.
I only worked on signatures for a day or two, it’s very very beta.
-
AuthorSearch Results