Answer the question
In order to leave comments, you need to log in
Is there a working plugin for posting scheduled(!) entries from WP to a VK group?
Guys, tell me please.
I tried different plugins, but I did not find a single working one that would correctly publish the PLANNED post. Who faced?
NextScripts: Social Networks Auto-Poster is very fancy. In theory, in the settings you can make a selection, for example, of a fresh post and publish it, but instead of publishing a post once, it goes around in circles. Although there is a correct parameter: "Wait for news posts". We see a bug. So I could not set it up for pending posts.
VK Poster Group is a great plugin but doesn't support the planned ones.
Answer the question
In order to leave comments, you need to log in
I'll add my fly in the ointment plus to the previous answers
1) query.Count() > 0 if this is a method from Linq and not defined in the class, then it's better not to do this. It will iterate over the entire IEnumerable, but do you need it? If you need to check if there are elements in the sequence, use query.Any()
2) in if-s, you can only define a query. and then just
if (query.Any())
{
ViewData["uncheckedProfiles"] = query.ToPagedList(pageNumber, pageSize);
}
else
{
ViewData["uncheckedProfilesSearch"] = "NoResult";
}
var query = MongoDBInstance.GetMongoDatabase.GetCollection<User>("UserInfo")
.AsQueryable<User>();
if (!string.IsNullOrEmpty(searchByName)) {
var upperCaseSearchString = searchByName.ToUpper()
string[] names = upperCaseSearchString.Split(' ');
if (names.Length > 1) {
query = query.Where(i=>
!i.IsActivated && ((
i.Name.ToUpper().Contains(names[0]) &&
i.LastName.ToUpper().Contains(names[1])) ||
(i.Name.ToUpper().Contains(names[1]) &&
i.LastName.ToUpper().Contains(names[0]))));
}
else {
query = query.Where(i=>
!i.IsActivated && (
i.Name.ToUpper().Contains(upperCaseSearchString) ||
i.LastName.ToUpper().Contains(upperCaseSearchString)));
}
}
else {
query = query.Where(i=>!i.IsActivated);
}
query = query.OrderBy(i=>i.ID);
if (query.Any()) {
ViewData["uncheckedProfiles"] = query.ToPagedList(pageNumber, pageSize);
}
else {
ViewData["uncheckedProfilesSearch"] = "NoResult";
}
Move part of the code into separate functions so as not to deepen the level of nesting too much.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question