Search Results for 'code'
-
AuthorSearch Results
-
July 30, 2007 at 3:44 pm #59569
In reply to: How to evaluate server speed?
_ck_
ParticipantPage transfer time alone was not-so-hot.
Front page, non-cached, no-images, no external js/css was 2.84 seconds. Loading a fresh topic took over 6 seconds in my browser.
No gzip web compression enabled.
PHP5 (~10%+ slower than PHP4)
There’s definitely no mysql cache – way, way too slow.
Can you put make yourself a phpinfo.php page and put
<? phpinfo(); ?>in there for us to check for other stuff? I don’t think it’s a security issue but others will have to agree or not.Another neat way to look at unknown servers is with this perlinfo cgi I found and hacked at a bit a few years ago. Rename that to perlinfo.cgi upload to your cgi-bin and chmod it to 755. Then we can maybe see a bit more. If you don’t know how to do all this, then nevermind.
I need at least one static page to compare it all to.
If you don’t mind saying, how much are you paying for this hosting? According to westhost’s page ALL clients are on their own VPS, even @ $4/mo which is kinda strange. If true, that means you can customize mysql yourself and install eaccelerator.
top w and uptime are all done from a “shell” via SSH. You need to email them and ask them how you access your shell. If you are indeed on a VPS you should have access to one. Many shared hosting hosts block shell access because of security issues.
July 30, 2007 at 1:23 pm #51581In reply to: Full Content of Most Recent Post on Front-Page?
fel64
MemberCool.
Can you post the entirety of the code you’re using now, in case someone else will be looking through the forums for a full solution?
July 30, 2007 at 8:03 am #59544In reply to: “My Threads” – User Specific Views
_ck_
ParticipantEr, wait a minute. This new view registation method takes away massive potential from views.
For example you can’t manipulate the data before and/or after the BB_QUERY.
Here’s how I find “most viewed” and “least viewed” topics and create new views for them. How the heck is this even remotely possible with the new method? The new method also takes away all natural mysql query methods, making things much more complicated and easier to make mistakes on query configuration.
function most_views( $view ) {
global $bbdb, $topics, $view_count;
if ($view=='most-views') {$sort="DESC";}
if ($view=='least-views') {$sort="ASC";}
if ($view=='least-views' || $view=='most-views') {
$limit = bb_get_option('page_topics');
$where = apply_filters('get_latest_topics_where','');
$most_views = $bbdb->get_results("SELECT topic_id FROM $bbdb->topicmeta WHERE meta_key='views' ORDER BY cast(meta_value as UNSIGNED) $sort LIMIT $limit");
foreach (array_keys($most_views) as $i) {$trans[$most_views[$i]->topic_id] =& $most_views[$i];} $ids = join(',', array_keys($trans));
$topics ="SELECT * FROM $bbdb->topics WHERE topic_status=0 AND topic_id IN ($ids) $where ORDER BY FIELD(topic_id, $ids)";
$topics = $bbdb->get_results($topics);
$view_count = count($topics);
$topics = bb_append_meta( $topics, 'topic' );
}}.
Absolutely no way to do that purely though BB_QUERY, at least to my limited knowledge. You’d have to hook BB_QUERY and check for what it’s doing on every call and that’s nasty.
July 30, 2007 at 7:58 am #59526In reply to: Protection against human spamming and double e-mail
nexlamar
MemberChris, that´s a good one – now I use the domain-restriction plugin. That should work for now
July 30, 2007 at 7:50 am #59488_ck_
ParticipantShow me the code how you are exposing the time/date fields to the moderators on a new post?
July 30, 2007 at 6:55 am #52662In reply to: Plugin: [REL] Signature
_ck_
ParticipantDumb question: What should I add to post.php?
Nothing. My version of this plugin requires absolutely no template or core edits. It’s why I made it

It’s optional to put the style in your style.css to prevent an extra stylesheet but that’s trivial and not necessary.
Note that I’ve turned on the default options of “one signature per user per page” and “only moderators and above can have signatures”. You can edit this in the plugin (change “moderate” to “participate”)
There are still many, many things not checked in this, like they could trick it to post 100 lines in a signature or use a HUGE image if you have “allow images” installed. This for now comes down to moderators doing their job.
July 30, 2007 at 6:34 am #59566In reply to: How to evaluate server speed?
_ck_
ParticipantSince there’s no real way to cache bbpress as static pages like wordpress (and not that there ever really can be, defeats the purpose) if you plan to have anything bigger than a “micro-forum” it’s important your host has mysql caching and optionally but recommend, some kind of php opcode cache (ie. eaccelerator)
Otherwise you’ll be getting emails from your host about your account creating all of the mysql load, etc.
The problem is I think most hosts do not have the two features I mentioned enabled. At least most shared hosting that’s done on cpanel “out of the box” on defaults. They have to be a bit more tech-savvy. And then if they are that clever, sometimes they will “oversell” the box thinking it can do more work than average.
Last but not least, on all shared hosting and VPS, you can have great performance for the moments you test it, but then a “bad neighbour” comes along and your performance will become quite bad for no reasons of your own, until the host does something about it, which can be days. Sometimes even the host can make poor decisions that will cripple your site, like backing it up during times of higher activity or allowing the statistics programs to run on dozens of clients at the exactly same time.
I wish I could afford dedicated hosting myself! Solves most of these problems. But spending $100 per year instead of $100 a month is no contest.
ps. 2.490 – 8 queries is not good at all if you are expecting high traffic – I have mysql cache and opcode cache and get always get under 0.300 for 10-30 queries no matter how many visitors. But I suspect I pay much more for my hosting. My guess is there’s definitely no mysql cache on there or you are paying very very little for that hosting.
July 30, 2007 at 5:25 am #59565In reply to: How to evaluate server speed?
chrishajer
ParticipantI would say if it seems slow to you now, it is going to seem slow to your users. especially when you have more of them. There’s a lot more to a good host than just the speed it takes to execute a bunch of queries, although that can point to a problem. My point is, there can be other problems that will not show up using just these diagnostics.
Do you have any information about the host, their connection to the Internet, the hardware they are using, the number of other websites on the shared machine? Do you have a link to your forum so others can see the speed you’re seeing? So you have shell access where you can run a command like
top?July 30, 2007 at 1:41 am #51580In reply to: Full Content of Most Recent Post on Front-Page?
outchy
Memberexcellent! i got it to work with this just before i checked back for your reply:
<a href="<?php echo get_topic_link($latestpost->topic_id); ?>"><?php echo get_topic_title($latestpost->topic_id); ?></a>i think i understand it better now, thanks again!
July 30, 2007 at 1:37 am #51579In reply to: Full Content of Most Recent Post on Front-Page?
fel64
MemberThat’s great! Passing parameters is just giving the function some data to work with.
$latestpost->topic_idis the topic ID. There are probably some functions liketopic_title()andlink_to_topic()or similar that you can use to get the title and link. They too will need the topic ID passed as a parameter, so if those are the actual functions it could betopic_title( $latestpost->topic_id );
July 30, 2007 at 1:10 am #51578In reply to: Full Content of Most Recent Post on Front-Page?
outchy
Memberwait, i got this to work to display the name:
<?php echo get_user_name($latestpost->poster_id); ?>and this to make it into a link to the person’s profile:
<a href="<?php user_profile_link($latestpost->poster_id); ?>"><?php echo get_user_name($latestpost->poster_id); ?></a>now all i need is to display the topic title and make it a link … i need help with this one please
July 30, 2007 at 1:06 am #51577In reply to: Full Content of Most Recent Post on Front-Page?
outchy
Memberso to get the last poster’s username to display, do you do something like this?
<?php echo get_user_name($user_id); ?>i guess i don’t understand the whole passing parameters thing
July 29, 2007 at 11:12 pm #59563In reply to: How to evaluate server speed?
fel64
MemberUse the port of a pretty cool wp server diagnostics plugin. https://bbpress.org/forums/topic/front-page-takes-50-mysql-queries?replies=15#post-9140
Just add
define( 'SAVEQUERIES', true );to your config.php and activate this. Then go to View > Page Source and scroll to the bottom to see the diagnostics. (You can ignore all the stuff about queries. Just check out query time, page time, page render time. This tells you about the server bottlenecks.)I just checked the numbers on my server, and I had 3.399 once and about twenty minutes later I had 0.436. This sort of thing can vary a lot, especially on shared hosting.
July 29, 2007 at 5:18 pm #51575In reply to: Full Content of Most Recent Post on Front-Page?
fel64
MemberI don’t know which ones you had problems with but it’s worth noting that some automatically echo and some don’t.
<?php user_profile_link(); ?>=
<?php echo get_user_profile_link(); ?>If they’re
get_anythingthen you have to echo them yourself, if they don’t haveget_*then it’ll echo on its own.[Edit] Also remember most functions don’t need a $user_id passed as parameter but won’t work in this case unless you do pass it.
July 29, 2007 at 5:18 pm #59450In reply to: How to link to favorites of logged user
_ck_
ParticipantOh if you are trying to do it from an integrated WordPress you’ll need to do this:
<?
if function_exists("get_currentuserinfo") {global $user_ID;}
else { $user_ID=bb_get_current_user_info( 'id' )}
if ($user_ID) { echo '<a href="/forums/profile.php?id='.$user_ID.'&tab=favorites">favorites</a>';} ?>untested – change /forums/ to whatever your bbpress path is.
July 29, 2007 at 5:10 pm #2181Topic: Protection against human spamming and double e-mail
in forum Troubleshootingnexlamar
MemberHi!
For my bbpress I need a check against human spam attacks.
For this I just need a random generated question in my language (the one that the spammers cannot speak
) and a check if the postet answert is correct. I tried to implement this into register.php, but my checks are ignored by bbpress. Is there anybody who can give me a hint, who maybe works on the same problem?I also figured out that I can register twice with the same e-mail adress. How can I check if the adress already exists?
Thanks for your help,
Markus
July 29, 2007 at 4:43 pm #51574In reply to: Full Content of Most Recent Post on Front-Page?
outchy
Memberyes, that worked, thank you.
i’m going through the template-functions.php trying to find how to display the last poster’s username and his/her profile link, as well as the link to the topic itself but the only ones i can get to work are these:
<?php echo $latestpost->post_text; ?>
<?php echo $latestpost->poster_id; ?>
<?php echo $latestpost->post_time; ?>
any suggestions?
July 29, 2007 at 1:46 pm #59539In reply to: “My Threads” – User Specific Views
Sam Bauers
Participant> Any idea what I could be doing wrong here?
Are you using the latest trunk or the standard 0.8.2.1 release?
Latest trunk won’t work with the above code.
July 29, 2007 at 1:33 pm #59537In reply to: “My Threads” – User Specific Views
howtogeek
MemberI activated this plugin, but when I click on the link for “topics i’ve started”, all I get is a white page… looking at a sql trace, it doesn’t appear to be running the code at all.
Any idea what I could be doing wrong here?
July 29, 2007 at 1:18 pm #59558In reply to: transfering wp and bb to the same db
fel64
MemberNot a problem as long as you have access to the databases.
Open phpMyAdmin through your administration panel of your web hosting account, go to your database, open wp_usermeta and then click the ‘Search’ tab. Put into the “search conditions” field user_id = 1 AND meta_key = 'bb_capabilities'(this should be the user_id of your admin account). Edit the (hopefully) one result that comes up, and change the meta_value toa:1:{s:9:"keymaster";b:1;}. Then you should be keymaster.July 29, 2007 at 12:55 pm #59327In reply to: Strange (?) (404) report i Firebug
Sam Bauers
ParticipantApache processes rewrite directives in the order they are found.
First the main Apache config file is used, then (if they are allowed) the .htaccess files are used in the order they are encountered from the root of the website out through the directories until the final directory that contains the file that is being accessed.
So if you have a page at http://www.example.com/blog/forum, then the order of processing is like:
Apache config
|
+-> /path/to/site/www.example.com/.htaccess
|
+-> /path/to/site/www.example.com/blog/.htaccess
|
+-> /path/to/site/www.example.com/blog/forum/.htaccessSo the “blog” rewrite rules will be assessed first. This means that you may want to place your bbPress rewrite rules in the same .htaccess file as your blog rules, before the blog rules, as they are more specific and should be handled first.
Also, there were some problems with WordPress throwing 404 errors based on what mod_rewrite was doing. This was specifically with version 2.1 I think, so your WordPress may need to be upgraded.
July 29, 2007 at 12:27 pm #49633In reply to: Emoticons For bbPress?
fel64
MemberIt’s Javascript. PHP files are just like HTML files, and anything outside the
<?php ... ?>is treated as HTML. Calling the particular function around that makes it go to that place and then go through and output the HTML (which happens to be JS).July 29, 2007 at 12:12 pm #59534In reply to: “My Threads” – User Specific Views
Sam Bauers
Participant> is there a method way to delete a view
In current trunk…
bb_deregister_view( $view )July 29, 2007 at 11:35 am #59532In reply to: “My Threads” – User Specific Views
_ck_
ParticipantUgh. So that breaks a view things I’ve done.
I’m waiting for an addition to the plugin svn and I’ll just update there at this point. I also missed checking if the user is logged in, now fixed.
I don’t run the newest trunk so I don’t have a way to test. Looks like I’ll have to setup a test account and install it again.
and I just put the finishes on a nice dropdown view box too…

function views_dropdown() {
$views_dropdown='<form name="views_dropdown" id="views_dropdown">
<select size=1 name="views_dropdown_select" onchange="if (this.selectedIndex != 0) {location=this.options[this.selectedIndex].value;}}">
<option value="#">SHOW ME
> </option>';
$views=get_views(); foreach ($views as $view => $title ) {
$views_dropdown.='<option value="'.get_view_link($view).'">'.$views[$view].'</option>';
}
$views_dropdown.='</select></form>'; echo $views_dropdown;
}July 29, 2007 at 11:30 am #59531In reply to: “My Threads” – User Specific Views
Sam Bauers
ParticipantYou should be aware that views are registered differently in the latest versions in trunk. Views are now constructed using the BB_Query class.
See the latest Support Forum plugin for a way to use both the new and old, although it is wrapped in a Class in there so the basic idea is:
if (is_callable('bb_register_view')) { // Build 876+
$query = <SOME ARRAY ACCEPTABLE TO BB_QUERY>;
bb_register_view('myview', __('My view name'), $query);
} else { // Build 214-875
add_filter('bb_views', 'my_addView');
add_action('bb_custom_view', 'my_processView');
} -
AuthorSearch Results