Search Results for 'code'
-
AuthorSearch Results
-
August 7, 2007 at 7:56 pm #59854
In reply to: Favorites on wordpress profile
vlp
MemberI change it, know there is no error, but no favorite forum shows up.
The deal is that my favorites dissaper, if I point my browser to http://www.tasty.sk/forum/profile/username/favorites, it redirects me to http://www.tasty.sk/user/username//favorites
It worked before, but probably I changed something so I thought maybe I create another favorites page
August 7, 2007 at 7:40 pm #59853In reply to: Favorites on wordpress profile
so1o
Participantyup use it in wordpress.. if i understand you right.. you want to show it on the wordpress profile page right? the one which is
<you website.com>/wp-admin/profile.php
try changing the code to
<?php if ($topics): foreach ( $topics as $topic ) : ?>
..
..
..
..
..
<?php endforeach; endif; ?>
August 7, 2007 at 6:36 pm #2214Topic: Add New Post Link
in forum Pluginshowtogeek
MemberFigured I’d throw this out there… I made a tiny function to generate a “reply” link anywhere in the topic. I’m using it in the post meta area to let the user quickly go to the post reply box.
function geek_post_reply_link(){
global $topic;
echo '<a href="'.get_topic_link($topic->topic_id,get_page_number( $topic->topic_posts )) . "#postform".'">Reply</a>';
}I couldn’t find anything else similar, so I thought I’d share.
August 7, 2007 at 5:41 pm #59852In reply to: Favorites on wordpress profile
vlp
MemberSo if I understand right, I should use this code as a WP plugin?
I tried that and I get an error:
Warning: Invalid argument supplied for foreach() in /home/tasty.sk/tasty.sk/www/wp-content/plugins/bbpress-favorites.php on line 30
It is shown in profile main page…it is possible to create another separate page for that?
August 7, 2007 at 5:14 pm #59248In reply to: Plugin: Plugin browser for bbPress
Null
Memberhmmm nice, i miss a download button
(in the plugin list to download the latest files)
August 7, 2007 at 3:47 pm #59851In reply to: Favorites on wordpress profile
so1o
Participanthere is the hacked code.. this will show the favorites on profile page in the admin section of wordpress. I haven’t tested it but this is the basic idea.
please note that the wordpress must be integrated both ways before you can do this. visit this for more
add_action('show_user_profile',
'my_plugin_show_favorites');
function my_plugin_show_favorites() {
$topics = get_user_favorites( $user->ID, true );
?>
<br clear="all" />
<table width="99%" border="0"
cellspacing="2" cellpadding="3">
<tr>
<th><?php _e('Topic'); ?></th>
<th><?php _e('Posts'); ?></th>
<th><?php _e('Freshness'); ?></th>
<th><?php _e('Remove'); ?></th>
</tr>
<?php foreach ( $topics as $topic ) : ?>
<tr<?php topic_class(); ?>>
<td><a href="<?php topic_link(); ?>">
<?php topic_title(); ?></a></td>
<td class="num"><?php
topic_posts();
?></td>
<td class="num"><small><?php
topic_time();
?></small></td>
<td class="num">[<?php
user_favorites_link(
'',
array('mid'=>'x'),
$user_id
);
?>]</td>
</tr>
<?php endforeach; ?>
</table>
<div class="nav">
<?php favorites_pages(); ?>
</div>
<?php
}August 7, 2007 at 2:56 pm #59850_ck_
ParticipantActually, it would be fairly easy to do.
All we need to do is hook into the header or footer.
My initial idea was javascript popups but those are bad because they stop all webpage loading at that point. If we hook the header we can insert a z-indexed hover div with the information.
The service would be passed a user_id, the message, and an action url. Optionally instead of a user_id, it could be the term “administrator” or “moderator” where it would alert all at that level.
The box would have a close button to ignore it and all the messages would then be accessible as a list under your profile under a new tab.
You’d have an option to be emailed anytime an alert was generated but typically you can keep that off unless you don’t visit the site often.
I was going to do this for my “report this post” plugin but I really needed the report feature right away so I got lazy and just used email.
Sounds like I have a new plugin to code next weekend.
August 7, 2007 at 12:41 pm #59811In 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.
-
AuthorSearch Results