I cannot understand what you want.
userinfo.php is an independent controller.
If you want to display it as a block, iframe will be the simplest way.
I will hack xoops cube be SNS
so I wish some blocks only display in "userinfo.php" page, like "friends list" or " monthly calendar"
I already succeed this hack
STEP1. Edit modules/system/admin/blocksadmin/
blockform.php & blocksadmin.phpadd
$module_list[-2] = "User Page"; before
$module_list[-1] = _AM_TOPPAGE;STEP2. Edit class/xoopsblock.php find function
getAllByGroupModule and
getNonGroupedBlocks change to
function &getAllByGroupModule($groupid, $module_id=0, $special_page=0, $visible=null, $orderby='b.weight,b.bid', $isactive=1)
{
$db =& Database::getInstance();
$ret = array();
$sql = "SELECT DISTINCT gperm_itemid FROM ".$db->prefix('group_permission')." WHERE gperm_name = 'block_read' AND gperm_modid = 1";
if ( is_array($groupid) ) {
$sql .= ' AND gperm_groupid IN ('.implode(',', $groupid).')';
} else {
if (intval($groupid) > 0) {
$sql .= ' AND gperm_groupid='.$groupid;
}
}
$result = $db->query($sql);
$blockids = array();
while ( $myrow = $db->fetchArray($result) ) {
$blockids[] = $myrow['gperm_itemid'];
}
if (!empty($blockids)) {
$sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid';
$sql .= ' AND b.isactive='.$isactive;
if (isset($visible)) {
$sql .= ' AND b.visible='.intval($visible);
}
$module_id = intval($module_id);
if (!empty($module_id)) {
$sql .= ' AND m.module_id IN (0,'.$module_id;
if ($special_page == '1') {
$sql .= ',-1';
}
$sql .= ')';
} else {
if ($special_page == 1) {
$sql .= ' AND m.module_id IN (0,-1)';
} elseif ($special_page == 2) {
$sql .= ' AND m.module_id IN (0,-2)';
} else {
$sql .= ' AND m.module_id=0';
}
}
$sql .= ' AND b.bid IN ('.implode(',', $blockids).')';
$sql .= ' ORDER BY '.$orderby;
//echo $sql;
$result = $db->query($sql);
while ( $myrow = $db->fetchArray($result) ) {
$block =& new XoopsBlock($myrow);
$ret[$myrow['bid']] =& $block;
unset($block);
}
}
return $ret;
}
function &getNonGroupedBlocks($module_id=0, $special_page=0,, $visible=null, $orderby='b.weight,b.bid', $isactive=1)
{
$db =& Database::getInstance();
$ret = array();
$bids = array();
$sql = "SELECT DISTINCT(bid) from ".$db->prefix('newblocks');
if ($result = $db->query($sql)) {
while ( $myrow = $db->fetchArray($result) ) {
$bids[] = $myrow['bid'];
}
}
$sql = "SELECT DISTINCT(p.gperm_itemid) from ".$db->prefix('group_permission')." p, ".$db->prefix('groups')." g WHERE g.groupid=p.gperm_groupid AND p.gperm_name='block_read'";
$grouped = array();
if ($result = $db->query($sql)) {
while ( $myrow = $db->fetchArray($result) ) {
$grouped[] = $myrow['gperm_itemid'];
}
}
$non_grouped = array_diff($bids, $grouped);
if (!empty($non_grouped)) {
$sql = 'SELECT b.* FROM '.$db->prefix('newblocks').' b, '.$db->prefix('block_module_link').' m WHERE m.block_id=b.bid';
$sql .= ' AND b.isactive='.$isactive;
if (isset($visible)) {
$sql .= ' AND b.visible='.intval($visible);
}
$module_id = intval($module_id);
if (!empty($module_id)) {
$sql .= ' AND m.module_id IN (0,'.$module_id;
if ($special_page == 1) {
$sql .= ',-1';
}
$sql .= ')';
} else {
if ($special_page == 1) {
$sql .= ' AND m.module_id IN (0,-1)';
} elseif ($special_page == 2) {
$sql .= ' AND m.module_id IN (0,-2)';
} else {
$sql .= ' AND m.module_id=0';
}
}
$sql .= ' AND b.bid IN ('.implode(',', $non_grouped).')';
$sql .= ' ORDER BY '.$orderby;
$result = $db->query($sql);
while ( $myrow = $db->fetchArray($result) ) {
$block =& new XoopsBlock($myrow);
$ret[$myrow['bid']] =& $block;
unset($block);
}
}
return $ret;
}
STEP3. Edit header.php find and change red color
$xoopsblock = new XoopsBlock();
$block_arr = array();
if (is_object($xoopsUser)) {
$xoopsTpl->assign(array('xoops_isuser' => true, 'xoops_userid' => $xoopsUser->getVar('uid'), 'xoops_uname' => $xoopsUser->getVar('uname'), 'xoops_isadmin' => $xoopsUserIsAdmin));
if (!empty($xoopsModule)) {
// set page title
$xoopsTpl->assign(array('xoops_pagetitle' => $xoopsModule->getVar('name'), 'xoops_modulename' => $xoopsModule->getVar('name'), 'xoops_dirname' => $xoopsModule->getVar('dirname')));
if (preg_match("/index\.php$/i", xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $xoopsModule->getVar('dirname')) {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $xoopsModule->getVar('mid'), 1, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), $xoopsModule->getVar('mid'), 0, XOOPS_BLOCK_VISIBLE);
}
} else {
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
if (!empty($xoopsOption['show_cblock'])) {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), 0, 1, XOOPS_BLOCK_VISIBLE);
} else {
//$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), 0, 0, XOOPS_BLOCK_VISIBLE);
if (preg_match("/userinfo\.php$/i", xoops_getenv('PHP_SELF'))) {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), 0, 2, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr =& $xoopsblock->getAllByGroupModule(XOOPS_GROUP_ANONYMOUS, 0, 0, XOOPS_BLOCK_VISIBLE);
}
}
}
} else {
$xoopsTpl->assign(array('xoops_isuser' => false, 'xoops_isadmin' => false));
if (!empty($xoopsModule)) {
// set page title
$xoopsTpl->assign(array('xoops_pagetitle' => $xoopsModule->getVar('name'), 'xoops_modulename' => $xoopsModule->getVar('name'), 'xoops_dirname' => $xoopsModule->getVar('dirname')));
if (preg_match("/index\.php$/i", xoops_getenv('PHP_SELF')) && $xoopsConfig['startpage'] == $xoopsModule->getVar('dirname')) {
$block_arr =& $xoopsblock->getAllByGroupModule(XOOPS_GROUP_ANONYMOUS, $xoopsModule->getVar('mid'), 1, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr =& $xoopsblock->getAllByGroupModule(XOOPS_GROUP_ANONYMOUS, $xoopsModule->getVar('mid'), 0, XOOPS_BLOCK_VISIBLE);
}
} else {
$xoopsTpl->assign('xoops_pagetitle', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
if (!empty($xoopsOption['show_cblock'])) {
$block_arr =& $xoopsblock->getAllByGroupModule(XOOPS_GROUP_ANONYMOUS, 0, 1, XOOPS_BLOCK_VISIBLE);
} else {
//$block_arr =& $xoopsblock->getAllByGroupModule(XOOPS_GROUP_ANONYMOUS, 0, 0, XOOPS_BLOCK_VISIBLE);
if (preg_match("/userinfo\.php$/i", xoops_getenv('PHP_SELF'))) {
$block_arr =& $xoopsblock->getAllByGroupModule($xoopsUser->getGroups(), 0, 2, XOOPS_BLOCK_VISIBLE);
} else {
$block_arr =& $xoopsblock->getAllByGroupModule(XOOPS_GROUP_ANONYMOUS, 0, 0, XOOPS_BLOCK_VISIBLE);
}
}
}
}
all done, now can setting block only display in
userinfo.php
I just know what you want.
But the way you posted does not look good.
Because you have to continue to merge the hack every updating the core.
My recommended way:
Just edit theme.html and control it by weight/title etc.
If you use XCL2.1.x, it might be the best way to create a "preload".
That's right, to extend XOOPS Cube just visit the forum "preload" there are some good examples.
Sugar, maybe you should check
CubeLet which allow you to place any content any where.
So, you wont need to reinvent the wheel ?
Have Fun !