This topic is locked
[SOLVED]

 how to publish or unpublish an article

8/16/2010 1:41:50 PM
PHPRunner General questions
S
siro author

I create litle project where someone put an article on line

I want to know the code where the user can publish and unpublish they own article
Thanks

Sergey Kornilov admin 8/16/2010

You can display published articles only adding the following WHERE clause to your query:
WHERE status='published'
Then on the Edit page define Status as dropdown box or as radio-button with two values: 'published' and 'not published'. This is it.

S
siro author 8/17/2010

Hi Admin

Can you show me an exemple about it : 'published' and 'not published'
Thanks

A
ann 8/18/2010

Joel,
set up 'Status' field as Checkbox or Radio button on the Edit as settings dialog on the Visual Editor tab.

Then use Before SQL query event on the Events tab to display articles (published and not published) of the current logged in user.

Here is a sample:

$strWhereClause=whereAdd($strWhereClause,"status='published'");
S
siro author 8/26/2010

Hi Ann and Admin
[size="2"]This is articles table[/size]

SELECT

articles.articleID,

articles.userID,

articles.PostDate,

articles.PostArticles,

articles.status

FROM articles

INNER JOIN users ON articles.userID = users.userID
[size="2"]This is users table[/size]

SELECT

userID,

UserName,

Password,

EmailAddress,

FirstName,

LastName

FROM users
I used status field for radio button (published and not published) in editpage:before sql query

I used this code ( $strWhereClause=whereAdd($strWhereClause,"status='published'"); )

the code is not working correctly, because when I click on edit button it is not working at all

I need more detail about this coed, Please

thank

Sergey Kornilov admin 8/26/2010

You should not do anything in events. WHERE clause needs to be added via SQL Query screen.
I would also drop the JOIN, it's meaningless in this scenario.
That's the query you need to use:



SELECT

articleID,

userID,

PostDate,

PostArticles,

status

FROM articles

WHERE status='published'
S
siro author 8/27/2010

I used this code but it does not work
SELECTarticleID,

userID,

PostDate,

PostArticles,

statusFROM articles

WHERE status='published'
What I want is, I want the users to have access to publish or not publish an article to the listpage with out delete any article from the listpage.

I need the code and an exemple
Please
Thanks

A
ann 8/31/2010

Joel,
set up field 'status' as checkbox on the Edit as settings dialog on the Visual Editor tab.

Then user will be eligible to check it on the Add/Edit pages to be published on the List page.
Modify the Sql query on the Edit SQL query tab as in the previous post, then there will be only published articles on the List page.

S
siro author 8/31/2010

Hi Ann

it is working now for (not published)

when I checked the check-box the article not show up on the Listpage,

but if the user wants to publish the article back on the Guest Listpage.
plese help me

Thanks

Sergey Kornilov admin 8/31/2010

Joel,
post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

S
siro author 9/2/2010

I maked it to work an other way, I created a cumtom views article table and I use status field as radio button (0) (1)

now the users can publish the article back to Guest ListPage
it is working now
Thanks