Fetching data from socialengine table

$music_category = Engine_Api::_()->getDbTable(‘cats’, ‘ynmusic’)->fetchAll();
$music_category_array = array();
foreach ($music_category as $category)
$music_category_array[“$category->cat_id”] = $category->title;

A sample form with 2 file upload button in socialengine

class Iriswidgetbox_Form_Index extends Engine_Form {
public function init() {
$this -> setTitle(‘Upload New Video’) -> setAttrib(‘id’, ‘form-upload’) -> setAttrib(‘name’, ‘avp_create’) -> setAttrib(‘enctype’, ‘multipart/form-data’);

$video_file = new Zend_Form_Element_File(‘video_path’);
$video_file -> setLabel(‘Video File Path’) -> setRequired(true) -> setDestination(‘uploads/’);
$photo_file = new Zend_Form_Element_File(‘photo_path’);
$photo_file -> setLabel(‘AD Photo File Path’) -> setRequired(true) -> setDestination(‘uploads/’);
$photo_url = new Zend_Form_Element_Text(‘url’);
$photo_url -> setLabel(“Link of photo with starting http://&#8221;);
// creating object for submit button
$submit = new Zend_Form_Element_Submit(‘submit’);
$submit -> setLabel(‘Upload Files’) -> setAttrib(‘id’, ‘submitbutton’);

// adding elements to form Object
$this -> addElements(array($video_file, $photo_file, $photo_url, $submit));


user id detection in socialengine

Here is the code for user id detection in socialengine
$viewer = Engine_Api::_()->user()->getViewer();

Not to render anything in a socialengine widget

See this code:
if ($key == “”)
return $this->setNoRender();

$this->setNoRender() in socialengine will not render anything to widget.
It is good if you don’t have necessary information to show in your widget, and more then that, if rendering will cause an error.

Integrating CI with SocialEngine: Matching the database tables

SE4 uses the table prefix as engine4_ , So what you can do to make the SE4 codes same for CI Tables?
You can add table prefix in CI. For example i used ‘engine4_webadmin’. Now SE4 can get the database table by prefix ‘engine4_’, where the CI will catch the tables with prefix ‘engine4_webadmin’.
You will not need to change the codes of either CI or SE4.
If you have another good option please let me know.

Free Social Engine: Plugins v4

Well all Social Engine 4 users , do you know why social engine 4 takes soo much server resource, its takes all server ram, WHY? Does Social Engine Official Team has this answer? No…… But Social Engine Forum aka SEF team has this answer with proper solution, would it be shared for free or premium.

Its not social engine 4 script problem, its because Social Engine 4 using InnoDB database, Problem lies inside your database and your server MYSQL configuration, you need to configure something in your MY SQL

Another solution to control Ram Buffer and some other things for innodb

For my UBUNTU LINUX SERVER EDITION 10.5 its file location


its configuration file of MYSQL

add these line in the end of file, and make sure entry should not be double, kindly search for same line in file before .









via Free Social Engine: Plugins v4.

code: example of using inner join in socialengine

$result_rows = $video_table->fetchAll(
// check privacy
->joinInner($files_table_name, “$files_table_name.file_id = $video_table_name.photo_id”)
->where($video_table_name.’.category_id = ?’,$category_row_id)
->order(“view_count DESC”)->limit(8)
foreach ($result_rows as $rows)
echo $rows->file_id;

What to do when you see there is no css in your socialengine application?

I got afraid when i saw there is no css working on my socialengine application. I was afraid that i have to make it from the beginning. 😦
But i went to the theme editor of admin panel and just pressed the save button again, i got my css back! 😀

How you can see log file in socialengine?

Well, the most common answer is , go to admin panel, then stats and then log viewer. Then temporary, and then log folder. There you will see the log files .
Why file browser? some times socialengine sucks due to innoDB storage engine. so you can easily check what happened to your application by viewing log files directly via file browser. 😀

Now another option, go to root directory of your project, then

Code for how to work with database in socialengine

//here the target is to get the category id of movie_review category

//The following line fetch database table object from socialengine database.

//the table is engine4_blog_categories so we used here getDbtable(‘categories’,’blog’)

$category_table = Engine_Api::_()->getDbtable(‘categories’,’blog’);

// now we got the table object in $category_table

// use print_r($category_table) to see what it gives you.


// the following line fetch the name of the table from table object.

// here we store the object in $category_table

$category_table_name = $category_table->info(‘name’);

// if we use print_r($category_table_name) we will get the table name


//now i will go to execute a query. the query is select * from $category_table_name where $category_table_name.category_name=”Movie Reviews” limit 1;

// limit 1 cause i know there is only one result for this query

$category_row = $category_table->fetchAll($category_table->select()->from($category_table_name)->where($category_table_name.’.category_name = ?’,”Movie Reviews”)->limit(1));

// i got it.


// now the following loop is used to get the desired category id.

$category_row_id = 0;

foreach ($category_row as $rows)


$category_row_id = $rows->category_id;


// $rows->{column name} will give you the data stored in that column.

// echo $category_row_id will show the id number of the category name.