Search Results for 'code'
-
AuthorSearch Results
-
August 7, 2007 at 3:49 am #59716
In 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
<?php
and 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=listplugins
here 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
div
s orli
and 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.php
and 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('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.
August 5, 2007 at 6:01 pm #59785In reply to: plugin: bb-Polls
_ck_
ParticipantNull, I am testing using opera 9 on windows.
I am using 0.24 of the plugin on the bbpress trunk.
I am able to create a new poll & vote with no alerts.
There is no problem with the css layout.
Make sure you create a NEW poll for testing with 0.24
Wait I just thought of something.
Are you using a personal firewall like Norton?
They sometimes filter javascript in bad ways.
I am also starting to think that php 5 is doing something weird with the data escaping since you say you get it in all browsers. Unfortunately I do not have a php 5 server to test on.
Can anyone else reproduce what Null is reporting or does it work?
ps. you can turn off ajax if you want to test it normally by changing the “use_ajax” option near the top of the code. Set it to “false”.
pps. Null, is this off the site in your profile?
Can you create a poll for me to see off one of the pages so I can see the bug in action?
August 5, 2007 at 5:55 pm #59796In reply to: Which filter/action hook should I use?
_ck_
Participant1. insert “quote” button on every post like my “report” button
2. don’t use javascript, use the arg add function and build a simple url for each quote button which references the source post id #
3. clicking said url button does a get from the server/bbpress
4. look for and capture the $_GET (ie. "epost=1327)
5. now the hard part, tell bbpress to start a new reply post in the topic and insert the formatted text from the quoted post. I have no clue how to pass bbpress existing text to a new post. Not even sure it has the action/filter to do it. I would bet not
August 5, 2007 at 5:50 pm #59784In reply to: plugin: bb-Polls
Null
MemberHmm You took away the brake between the option for single or multy votes? Shame
Ow and yes that caching in Opera is true, I always solve it to give it an unique time thingy to force Opera to reload instead of using cache.
Also I get this bug in Opera now:
You haven’t selected anything!
Well I DID select something
Can’t vote at all now, keeps saying that message!
Also the other issue with the standard template isn’t solved yet!
August 5, 2007 at 5:17 pm #59783In reply to: plugin: bb-Polls
_ck_
ParticipantAh I think I see the problem.
Unlike all the other browsers, Opera has taken it upon itself to cache the javascript request instead of actually fetching it each time (this is one way it cheats for speed).
Will add some code for a unique URL to force it to work.
okay, here you go, v0.24
http://ckon.wordpress.com/files/2007/08/bb-polls.txt?v024
should fix the issues with opera (and anything else caching)
I’ve also now added hidden near the top of the code a “test_mode”
If you change “test_mode” to “true” it will allow you do keep voting on any poll for testing purposes. You can switch back and forth to view/vote etc. Obviously change it back on a live site with members or people will be able to stuff the ballot box.
Keep in mind that previous poll data may have been made invalid by the bug in opera so start with a fresh poll. Do not keep re-using the old polls for testing with v0.24. I have not changed data structures but if the data got inserted wrong, it could be invalid for that topic.
(I’ll make a “delete poll” option soon for administrators.
The space it takes is trivial, so don’t worry about that)
-
AuthorSearch Results