Posts with the name or tag of JCow;

by emran

JCow’s Events Join Modification

4:32 pm in Elgg, JCow by emran

I love jcow script.it is very nice and faster. It is very simple to implement in production website though some modification is required.

I found that in the Event module,  “i want to join” button always keep front even user already clicked the join button.it should not show if user already join on the event.

It can be changed easily.Please follow the steps to modify:

1. Go to modues/events/events.php

2. go to line no 70. where u will find hook_viewstory() function.

then you place code as following.

Events join modification

Events join modification

3. Now refresh the events page and check that it will not show if you already join the event.

That’s all

by emran

Shoutbox Module for JCow

9:45 am in JCow by emran

I have written another module for JCow.It is shoutbox.

The Shoutbox module provides a block where visitors can quickly post short messages.

  • Post messages instantly via AJAX
  • Optionally have messages auto-refresh via AJAX
  • A cron option allows the administrator to have old shouts deleted.[not implemented yet]

Let me know if you have any issues.

JCow Shoutbox

JCow Shoutbox

How to setup:

1. Download the Modules shoutbox.

2.  Copy and paste the modules to the directory modules/shoutbox

3. Go to Admin CP and Install shoubox module

4. Then edit dashboard script from modules/dashboard.php and put the following code in the index() function

//after this code
block(
friends_birthday()
);

//Add this Code

include_once ‘modules/shoutbox/shoutbox.php’;

$sb=new shoutbox();
block(
$sb->shout_box()
);

by emran

Jcow Social Script Admin Add User

3:48 pm in Elgg, JCow by emran

I saw some request in JCow forum about user add from admin panel.
So i gave sometimes and it works.

Here is the code:

1. First you have to edit modules/admin/admin.php

and put these two function.

function useradd(){
nav(t(‘Users/Add User’));
section_content(‘
<fieldset>
<form action=”‘.url(‘admin/useraddpost’).’” method=”post”>
‘);

section_content(‘
<p>
‘.label(‘Full Name’).’
<input type=”text” name=”fullname” size=30 />
</p>

<p>
‘.label(‘Username’).’
<input type=”text” name=”username” size=30 />
</p>
<p>
‘.label(‘Password’).’
<input type=”text” name=”password” size=30 />
</p>
<p>
‘.label(‘E-mail’).’
<input type=”text” name=”email” size=30 />
</p>
<p>
‘.label(t(‘Gender’)).’
<input type=”radio” name=”gender” value=1 checked/> Male
<input type=”radio” name=”gender” value=0 /> Female
<input type=”radio” name=”gender” value=2 /> Hide<br />
</p>

<p>
‘.label(t(‘Status’)).’
<input type=”radio” name=”disabled” value=0 checked/> Active
<input type=”radio” name=”disabled” value=1 /> Pending
<input type=”radio” name=”disabled” value=2 /> Suspended<br />
</p>

<p>
<input type=”submit” value=”‘.t(‘Add User’).’” />
</p>
</form>
</fieldset>’);
}

the above function will show form to add user.

function useraddpost(){

$_POST['username'] = strtolower($_POST['username']);

if (strlen($_POST['username']) < 4 || strlen($_POST['username']) > 18 || !ereg(“^[0-9a-z]+$”,$_POST['username'])) {
$errors[] = t(‘Username’).’: ‘.t(‘from 4 to 18 characters, only 0-9,a-z’);
}

if (!$_POST['email'] || !$_POST['fullname'] || !$_POST['username'] || !$_POST['password']) {
$errors[] = t(‘Please fill in all the required blanks’);
}

if(!eregi(“^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$”, $_POST['email'])) {
$errors[] = t(‘Unavailable email address’);
}

$password = md5($_POST['password'].’jcow’);
$timeline = time();
$res = sql_query(“select * from `”.tb().”accounts` where email=’{$_POST['email']}’”);
if (sql_counts($res)) {
$errors[] = t(‘You have registered with this email address before.’);
}
$res = sql_query(“select * from `”.tb().”accounts` where username=’{$_POST['username']}’”);
if (sql_counts($res)) {
$errors[] = t(‘The Username has already been used’);
}

if(!is_array($errors)){

sql_query(“insert into `”.tb().”accounts` (hide_age,gender,disabled,password,email,username,fullname,created) values
(’1′,”.$_POST['gender'].”,”.$_POST['disabled'].”,’$password’,'”.$_POST['email'].”‘,’”.$_POST['username'].”‘,’”.$_POST['fullname'].”‘,’”.$timeline.”‘)”);
$uid = insert_id();
sql_query(“insert into `”.tb().”profiles` (id,style_ids) values($uid,’3|3|3′)”);
stream_publish(t(‘Signed Up’),”,”,$uid);
t(‘Congratulations! You have successfully created user.’);
redirect(“admin/users”);
}else {
foreach ($errors as $error) {
$error_msg .= ‘<li>’.$error.’</li>’;
}
sys_notice(t(‘Errors’).’:<ul>’.$error_msg.’</ul>’);
}

}

The above function will add user after submitting.

2. Now add this line to users() function of admin.php files.

c(“<p><a href=”.url(“admin/useradd”).”>Add User</a></p>”);

Jcow Admin Add user

Jcow Admin Add user Link

3. That’s all. Go to admin panel->members->add user. i hope rest of work you can do:P..

Download the source code.

Jcow Admin Add user Source

by admin

Hide Admin user from recent login in JCow Social script

2:50 pm in Elgg, JCow by admin

you can apply a tricks not to show admin on the recent logins or recent members like this.

Open theme’s page.tpl.php and go to line no 170.

Change with following query.it will not show admin.

$res = sql_query(“SELECT * from `”.tb().”accounts` where roles!=3 order by lastlogin desc limit 20″);

by emran

SMTP Module at JCow Social Script

1:28 pm in Elgg, JCow by emran

This is my first module for JCow Social script. Sometimes we need remote SMTP server to send out email.This script will help you to send out email from remote SMTP server even gmail or yahoo.It supports SSL connection too.

First, You need to download class.smtp.php and class.phpgmailer.php scripts and place into  includes/libs/ folder under JCow directory.

Now add these files to boot.inc.php from includes/ folder.

//loading SMTP Library
require_once ‘./includes/libs/class.phpgmailer.php’;
require_once ‘./includes/libs/class.smtp.php’;

Now edit my/config.php files and put smtp parameters as like follows:

$config['smtp_host']=’127.0.0.1′;
$config['smtp_port']=25;
$config['smtp_auth']=true;
$config['smtp_user']=’YOUR USERNAME’;
$config['smtp_pass']=’YOUR PASSWORD’;
$config['smtp_html']=true;
$config['smtp_from']=’noreply@YOURDOMAIN’;

Now the final step. Edit includes/libs/common.inc.php and write mailer function :

function jcow_user_mail($to,$subject,$message,$reply=”){
global $config;
$mail = new PHPGMailer();
$mail->Username = $config['smtp_user'];
$mail->Password = $config['smtp_pass'];
$mail->From = $config['smtp_from'];
$mail->FromName = get_gvar(‘site_name’);
$mail->Host=$config['smtp_host'];
$mail->Port=$config['smtp_port'];
$mail->Subject = $subject;
$mail->AddAddress($to);
$mail->Body = $message;
$mail->IsHTML=$config['smtp_html'];;

return $mail->Send();

}

Now all email will send out via SMTP server.This is tested script.

Download SMTP Module for JCow

by admin

JCow as Opensource Social Networking script

1:10 pm in Elgg, JCow by admin

Few days back, I was asking to make a website for a alumni association.They need a function as like facebook.After that I had started searching on google.I found have few scripts.Out of them, I liked three scripts i.e. Elgg,  Dolphin and JCow.

I discover that JCow is nicely developed.Although, i was strange to see the name “JCow” as social networking script.It is very easier to extend.It is very lightweight and faster than others. So i decided to work on JCow.JCow has some lack of features but it can be extended easily.I have written some scripts for my website.I will share it soon.

Happy JCowing……!