Uutiset:

Wondering if this will always be free?  See why free is better.

Main Menu
Advertisement:

How to give permission my page in public access?

Aloittaja chinmay235, huhtikuu 04, 2014, 01:38:05 AP

« edellinen - seuraava »

chinmay235

Hi I have added some code in Profile.php and Profile-View.php


http://www.xyz.com/index.php?action=profile;area=showfollowvotes;u=1 [nofollow]

In this above link when i am opening it without register the profile page is showing which is user id = 1 But i want to show the proper showfollowvotes page

Profile.php - Menu(Seguimiento de películas)
'showfollowvotes' => array(
'label' => $txt['editCustomFollowList'],
'file' => 'Profile-View.php',
'function' => 'showFollowVotes',
'subsections' => array(
'projects' => array($txt['showCustomFollowFilms_projects'], array('profile_view_own', 'profile_view_any')),
'films' => array($txt['showCustomFollowFilms_films'], array('profile_view_own', 'profile_view_any')),
),
'permission' => array(
'any' => 'profile_view_own',
'any' => 'profile_view_own',
),
),


Profile-View.php
function showFollowVotes($memID)
{
global $txt, $user_info, $scripturl, $modSettings;
global $context, $user_profile, $sourcedir, $smcFunc, $board;

// Some initial context.
$context['start'] = (int) $_REQUEST['start'];
$context['current_member'] = $memID;

// Create the tabs for the template.
$context[$context['profile_menu_name']]['tab_data'] = array(
'title' => $txt['showCustomFollowFilms'],
'description' => $txt['showCustomFollowFilms_help'],
'icon' => 'follow_vote.png',
'tabs' => array(
'projects' => array(
),
'films' => array(
),
),
);

/*echo "<pre>";
print_r($context);
echo "</pre>";*/

// Set the page title
$context['page_title'] = $txt['showCustomFollowFilms_projects'] . ' - ' . $user_profile[$memID]['real_name'];

// Are we just viewing films follow?
$context['is_films'] = isset($_GET['sa']) && $_GET['sa'] == 'films' ? true : false;

//$connectForum = mysqli_connect("localhost", "root", "", "elseptimoarte") or die ("Unable to connect!");
$connectForum = mysqli_connect("localhost", "elseptimprueba4", "123654e7a", "elseptimprueba4") or die ("Unable to connect!");

// Default to 10.
if (empty($_REQUEST['viewscount']) || !is_numeric($_REQUEST['viewscount']))
$_REQUEST['viewscount'] = '12';

if ($context['is_films']){
$request = mysqli_query($connectForum,"SELECT COUNT(*) FROM nuke_peliculas a, nuke_follow_movie b WHERE a.fecha_es <= now() AND a.fecha_es != '0000-00-00' AND b.user_id=$memID AND a.peli_id=b.movie_id");
}
else{
$request = mysqli_query($connectForum,"SELECT COUNT(*) FROM nuke_peliculas a, nuke_follow_movie b WHERE (a.fecha_es > now() OR a.fecha_es = '0000-00-00') AND b.user_id=$memID AND a.peli_id=b.movie_id");
}
list ($msgCount) = mysqli_fetch_row($request);
mysqli_free_result($request);

$request = mysqli_query($connectForum, 'SELECT MIN(id), MAX(id) FROM nuke_follow_movie AS m WHERE m.user_id ='.$memID);
list ($min_msg_member, $max_msg_member) = mysqli_fetch_row($request);
mysqli_free_result($request);



$reverse = false;
$range_limit = '';
$maxIndex = 12;

// Make sure the starting place makes sense and construct our friend the page index.
$context['page_index'] = constructPageIndex($scripturl . '?action=profile;u=' . $memID . ';area=showfollowvotes' . ($context['is_films'] ? ';sa=films' : ''), $context['start'], $msgCount, $maxIndex);
$context['current_page'] = $context['start'] / $maxIndex;

// Reverse the query if we're past 50% of the pages for better performance.
$start = $context['start'];
/*$reverse = $_REQUEST['start'] > $msgCount / 2;
if ($reverse)
{
$maxIndex = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 && $msgCount > $context['start'] ? $msgCount - $context['start'] : (int) $modSettings['defaultMaxMessages'];
$start = $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] + 1 || $msgCount < $context['start'] + $modSettings['defaultMaxMessages'] ? 0 : $msgCount - $context['start'] - $modSettings['defaultMaxMessages'];
}*/
// Find this user's posts.  The left join on categories somehow makes this faster, weird as it looks.
$looped = false;

if ($context['is_films'])
{
$request = mysqli_query($connectForum,"SELECT a.cartel,a.cartel_es,a.cartel_vo,a.titulo_es,a.titulo,a.titulo_url,a.fecha_es,a.genero,a.ano,b.user_id,b.movie_id FROM nuke_peliculas a, nuke_follow_movie b WHERE a.fecha_es <= now() AND a.fecha_es != '0000-00-00' AND b.user_id=$memID AND a.peli_id=b.movie_id ORDER BY a.ano DESC LIMIT " . $start . ", " . $maxIndex);
}
else
{
$request = mysqli_query($connectForum,"SELECT a.cartel,a.cartel_es,a.cartel_vo,a.titulo_es,a.titulo,a.titulo_url,a.fecha_es,a.genero,a.ano,b.user_id,b.movie_id FROM nuke_peliculas a, nuke_follow_movie b WHERE (a.fecha_es > now() OR a.fecha_es = '0000-00-00') AND b.user_id=$memID AND a.peli_id=b.movie_id ORDER BY a.ano ASC LIMIT " . $start . ", " . $maxIndex);
}

// Make sure we quit this loop.
//if (mysqli_num_rows($request) === $maxIndex || $looped)
// break;
$looped = true;
$range_limit = '';


// Start counting at the number of the first message displayed.
$forum_follow_count=mysqli_num_rows($request);
$context['forum_follow_count']=$forum_follow_count;
$counter = $reverse ? $context['start'] + $maxIndex + 1 : $context['start'];
$context['posts'] = array();
while ($row = mysqli_fetch_assoc($request))
{
// And the array...
$context['posts'][$counter += $reverse ? -1 : 1] = array(
'cartel' => $row['cartel'],
'cartel_es' => $row['cartel_es'],
'cartel_vo' => $row['cartel_vo'],
'titulo_es' => $row['titulo_es'],
'titulo' => $row['titulo'],
'titulo_url' => $row['titulo_url'],
'publish_time' => $row['fecha_es'],
'genero' => $row['genero'],
'ano' => $row['ano'],
'user_id' => $row['user_id'],
'peli_id' => $row['movie_id'],
'alternate' => $counter % 2,
);
}
//$smcFunc['db_free_result']($request);
}


check this two url
http://www.elseptimoarte.net/foro/index.php?action=profile;u=2413 [nofollow]
http://www.elseptimoarte.net/foro/index.php?action=profile;area=showfollowvotes;u=2413 [nofollow]


I want to make public access the page showfollowvotes.


See the attachment image. This page is coming after someone login. But I want to this page in public access(no login and register required).

margarett

That has to be permissions-related. Specifically, you have this:

'permission' => array(
'any' => 'profile_view_own',
'any' => 'profile_view_own',
),

You should have own --> own and any --> any.
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

LainaaOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Advertisement: