Activity Default to My Friends

//Put this in your functions.php

function lmc_query_filter( $query_string ) {
$query_string .= '&scope=friends';
return $query_string;
}

//Change the loop in activity-loop.php
//Default to My Friends
if($_GET['friends'] == 'true'){
add_filter('bp_dtheme_ajax_querystring','lmc_query_filter');
} <?php if (bp_has_activities(lmc_activity_default())) : ?>

//Change the main activity link to include the 'friends=true' query string, in header.php
<li<?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?> class="selected"<?php endif; ?>>
<a href="<?php echo site_url() ?>/<?php echo BP_ACTIVITY_SLUG ?>/?friends=true" title="<?php _e( 'Activity', 'buddypress' ) ?>"><?php _e( 'Activity', 'buddypress' ) ?></a>
</li>

Intercept Ajax Query

//Members query switch
function lmc_members_query($members_query){
parse_str($members_query,$query_vars);
switch($query_vars['scope']){
case 'fans':
$members_query .= "&search_terms=Fan Account";
break;
case 'bands':
$members_query .= "&search_terms=Band Account";
break;
case 'venues':
$members_query .= "&search_terms=Venue Account";
break;
default:
return $members_query;
}
return $members_query;
}

//Add the above to your functions.php and then modify the bp loop within whatever area you want, for instance this is the modified version for the members loop:

<?php $members_query = lmc_members_query(bp_ajax_querystring('members'));?>

<?php if (bp_has_members($members_query)) :?>

Image resize class

<?php
/*
* File: SimpleImage.php
* Author: Simon Jarvis
* Copyright: 2006 Simon Jarvis
* Date: 08/11/06
* Link: http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
* http://www.gnu.org/licenses/gpl.html
*
*/

class SimpleImage {

var $image;
var $image_type;

function load($filename) {
$image_info = getimagesize($filename);
$this->image_type = $image_info[2];
if( $this->image_type == IMAGETYPE_JPEG ) {
$this->image = imagecreatefromjpeg($filename);
} elseif( $this->image_type == IMAGETYPE_GIF ) {
$this->image = imagecreatefromgif($filename);
} elseif( $this->image_type == IMAGETYPE_PNG ) {
$this->image = imagecreatefrompng($filename);
}
}
function save($filename, $image_type=IMAGETYPE_JPEG, $compression=75, $permissions=null) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image,$filename,$compression);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image,$filename);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image,$filename);
}
if( $permissions != null) {
chmod($filename,$permissions);
}
}
function output($image_type=IMAGETYPE_JPEG) {
if( $image_type == IMAGETYPE_JPEG ) {
imagejpeg($this->image);
} elseif( $image_type == IMAGETYPE_GIF ) {
imagegif($this->image);
} elseif( $image_type == IMAGETYPE_PNG ) {
imagepng($this->image);
}
}
function getWidth() {
return imagesx($this->image);
}
function getHeight() {
return imagesy($this->image);
}
function resizeToHeight($height) {
$ratio = $height / $this->getHeight();
$width = $this->getWidth() * $ratio;
$this->resize($width,$height);
}
function resizeToWidth($width) {
$ratio = $width / $this->getWidth();
$height = $this->getheight() * $ratio;
$this->resize($width,$height);
}
function scale($scale) {
$width = $this->getWidth() * $scale/100;
$height = $this->getheight() * $scale/100;
$this->resize($width,$height);
}
function resize($width,$height) {
$new_image = imagecreatetruecolor($width, $height);
imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $this->getWidth(), $this->getHeight());
$this->image = $new_image;
}
}
?>

Reserved Words

ACCESSIBLE
ADD
ALL
ALTER
ANALYZE
AND
AS
ASC
ASENSITIVE
BEFORE
BETWEEN
BIGINT
BINARY
BLOB
BOTH
BY
CALL
CASCADE
CASE
CHANGE
CHAR
CHARACTER
CHECK
COLLATE
COLUMN
CONDITION
CONSTRAINT
CONTINUE
CONVERT
CREATE
CROSS
CURRENT_DATE
CURRENT_TIME
CURRENT_TIMESTAMP
CURRENT_USER
CURSOR
DATABASE
DATABASES
DAY_HOUR
DAY_MICROSECOND
DAY_MINUTE
DAY_SECOND
DEC
DECIMAL
DECLARE
DEFAULT
DELAYED
DELETE
DESC
DESCRIBE
DETERMINISTIC
DISTINCT
DISTINCTROW
DIV
DOUBLE
DROP
DUAL
EACH
ELSE
ELSEIF
ENCLOSED
ESCAPED
EXISTS
EXIT
EXPLAIN
FALSE
FETCH
FLOAT
FLOAT4
FLOAT8
FOR
FORCE
FOREIGN
FROM
FULLTEXT
GRANT
GROUP
HAVING
HIGH_PRIORITY
HOUR_MICROSECOND
HOUR_MINUTE
HOUR_SECOND
IF
IGNORE
IN
INDEX
INFILE
INNER
INOUT
INSENSITIVE
INSERT
INT
INT1
INT2
INT3
INT4
INT8
INTEGER
INTERVAL
INTO
IS
ITERATE
JOIN
KEY
KEYS
KILL
LEADING
LEAVE
LEFT
LIKE
LIMIT
LINEAR
LINES
LOAD
LOCALTIME
LOCALTIMESTAMP
LOCK
LONG
LONGBLOB
LONGTEXT
LOOP
LOW_PRIORITY
MASTER_SSL_VERIFY_SERVER_CERT
MATCH
MEDIUMBLOB
MEDIUMINT
MEDIUMTEXT
MIDDLEINT
MINUTE_MICROSECOND
MINUTE_SECOND
MOD
MODIFIES
NATURAL
NOT
NO_WRITE_TO_BINLOG
NULL
NUMERIC
ON
OPTIMIZE
OPTION
OPTIONALLY
OR
ORDER
OUT
OUTER
OUTFILE
PRECISION
PRIMARY
PROCEDURE
PURGE
RANGE
READ
READS
READ_WRITE
REAL
REFERENCES
REGEXP
RELEASE
RENAME
REPEAT
REPLACE
REQUIRE
RESTRICT
RETURN
REVOKE
RIGHT
RLIKE
SCHEMA
SCHEMAS
SECOND_MICROSECOND
SELECT
SENSITIVE
SEPARATOR
SET
SHOW
SMALLINT
SPATIAL
SPECIFIC
SQL
SQLEXCEPTION
SQLSTATE
SQLWARNING
SQL_BIG_RESULT
SQL_CALC_FOUND_ROWS
SQL_SMALL_RESULT
SSL
STARTING
STRAIGHT_JOIN
TABLE
TERMINATED
THEN
TINYBLOB
TINYINT
TINYTEXT
TO
TRAILING
TRIGGER
TRUE
UNDO
UNION
UNIQUE
UNLOCK
UNSIGNED
UPDATE
USAGE
USE
USING
UTC_DATE
UTC_TIME
UTC_TIMESTAMP
VALUES
VARBINARY
VARCHAR
VARCHARACTER
VARYING
WHEN
WHERE
WHILE
WITH
WRITE
XOR
YEAR_MONTH
ZEROFILL

Scroll page

<script type="text/javascript">

function jumpScroll() {
window.scroll(0,840); // horizontal and vertical scroll targets
}

</script>

<a href="javascript:jumpScroll()">Jump to another place on the page</a>

Easy options table class

<?php

/*
* HypOptionsTable Class
* Constructor: $new_hyper_options = new HypOptionsTable($table_name,$option_names);// Pass options names as an array
* Access the table: $hyper_options_ref = new HypOptionsTable($tablename);// No second argument = no table created
*
* For MU it is usefull to create a table with the prefix of the child blog, like wp_3_mytablename. These will be cleaned
* up when said child site is deleted from the MU interface.
*/

class HypOptionsTable{
private $_table_name;
private $_option_names;

public function __construct($table_name,$option_names = false){
if($table_name) $this->_table_name = $table_name;
if($option_names){
$this->_option_names = $option_names;
$this->create_table();
}
}
private function create_table(){
global $wpdb;
$table_name = $this->_table_name;
$option_names = $this->_option_names;
$db_version = '1.0';
if($wpdb->get_var("show tables like '$table_name'") != $table_name){
$sql = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
option_name VARCHAR(100) NOT NULL,
option_value TEXT NOT NULL,
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
add_option('db_version',$db_version);
//Instert Tables
foreach($option_names as $name){
$wpdb->insert($table_name, array('option_name' => $name,'option_value' => ''));
}
}
}
public function addOption($option_name,$option_value){
global $wpdb;
$table_name = $this->_table_name;
if($wpdb->query("SELECT * FROM $table_name WHERE option_name = '$option_name'")) $this->updateOption($option_name,$option_value);
else $wpdb->insert($table_name, array('option_name' => $option_name,'option_value' => $option_value));
}
public function updateOption($option_name,$option_value){
global $wpdb;
$table_name = $this->_table_name;
$wpdb->update($table_name, array('option_value' => $option_value), array('option_name' => $option_name));
}
public function getOption($option_name){
global $wpdb;
$table_name = $this->_table_name;
$results = $wpdb->get_row("SELECT option_value FROM $table_name WHERE option_name = '$option_name'");
return $results->option_value;
}
public function deleteOption($option_name){
global $wpdb;
$table_name = $this->_table_name;
$wpdb->query("DELETE FROM $table_name WHERE option_name = '$option_name'");
}

}//End HypOptionsTable

/*
//Test Constructor, creates table
$option_name_array = array('username','email','password');
$new_hyper_options = new HypOptionsTable('wp_hyper_options',$option_name_array);

//Test Reference - New table not created due to lack of second argument
$hyper_options = new HypOptionsTable('wp_hyper_options');
$hyper_options->addOption('rudeness_level','wicked bad');

//Test Update
$hyper_options->updateOption('username','dippy');

//Test Get
echo $hyper_options->getOption('username');
*/

?>